Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
refactor: ability to disable sidebar shadow
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Sep 10, 2019
1 parent 3e31a62 commit 04d839a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
29 changes: 17 additions & 12 deletions renderer/components/UI/Sidebar.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
import React from 'react'
import styled from 'styled-components'
import { themeGet } from '@styled-system/theme-get'
import PropTypes from 'prop-types'
import { Flex } from 'rebass/styled-components'

const SidebarBox = styled(Flex)`
overflow: hidden;
box-shadow: ${themeGet('shadows.m')};
z-index: 1;
`

const Sidebar = ({ ...props }) => (
<SidebarBox
const Sidebar = ({ hasShadow, ...rest }) => (
<Flex
as="aside"
bg="primaryColor"
color="primaryText"
flexDirection="column"
width={4 / 12}
{...props}
{...rest}
sx={{
overflow: 'hidden',
boxShadow: hasShadow ? 'm' : null,
zIndex: 1,
}}
/>
)

Sidebar.propTypes = {
hasShadow: PropTypes.bool,
}

Sidebar.defaultProps = {
hasShadow: true,
}

Sidebar.small = props => <Sidebar {...props} width={3 / 16} />
Sidebar.medium = props => <Sidebar {...props} width={4 / 16} />
Sidebar.large = props => <Sidebar {...props} width={6 / 16} />
Expand Down
6 changes: 3 additions & 3 deletions test/unit/components/UI/__snapshots__/Sidebar.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ exports[`component.UI.Sidebar should render correctly 1`] = `
box-sizing: border-box;
margin: 0;
min-width: 0;
background-color: primaryColor;
overflow: hidden;
box-shadow: m;
z-index: 1;
color: primaryText;
-webkit-flex-direction: column;
-ms-flex-direction: column;
Expand All @@ -15,8 +17,6 @@ exports[`component.UI.Sidebar should render correctly 1`] = `
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
overflow: hidden;
z-index: 1;
}
<aside
Expand Down

0 comments on commit 04d839a

Please sign in to comment.