Skip to content

Commit

Permalink
Adjust SideNav-related components (#280)
Browse files Browse the repository at this point in the history
Adjust SideNav-related components
  • Loading branch information
felixjung authored Aug 24, 2018
1 parent 805e8cf commit e7ef881
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
14 changes: 12 additions & 2 deletions src/components/Popover/Popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ import { toPopperPlacement, popperModifiers } from './PopoverService';
const ReferenceWrapper = styled('div')`
label: popover__button-wrapper;
display: inline-block;
&:focus {
outline: none;
}
${({ referenceWrapperStyles, ...rest }) => referenceWrapperStyles(rest)};
`;

const basePopoverWrapperStyles = ({ theme }) => css`
Expand Down Expand Up @@ -129,7 +132,11 @@ class Popover extends Component {
usePortal: PropTypes.bool,
modifiers: PropTypes.shape(),
arrowRenderer: PropTypes.func,
referenceElement: PropTypes.element
referenceWrapperStyles: PropTypes.func,
referenceElement: PropTypes.oneOfType([
PropTypes.instanceOf(HTMLElement),
PropTypes.element
])
};

static defaultProps = {
Expand All @@ -142,7 +149,8 @@ class Popover extends Component {
modifiers: {},
arrowRenderer: () => null,
renderReference: () => null,
referenceElement: null
referenceElement: null,
referenceWrapperStyles: () => null
};

componentDidMount() {
Expand Down Expand Up @@ -186,6 +194,7 @@ class Popover extends Component {
renderPopover,
renderReference,
referenceElement,
referenceWrapperStyles,
position,
align,
isOpen,
Expand All @@ -199,6 +208,7 @@ class Popover extends Component {
<Reference>
{({ ref }) => (
<ReferenceWrapper
referenceWrapperStyles={referenceWrapperStyles}
innerRef={this.receiveButtonRef}
onClick={this.handleReferenceClick}
>
Expand Down
7 changes: 5 additions & 2 deletions src/components/SideNav/SideNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
} from './components';
import { childrenPropType } from '../../util/shared-prop-types';

import { disableVisually } from '../../styles/style-helpers';

export const COLLAPSED_NAV_WIDTH = 64;
export const FULL_NAV_WIDTH = 270;

Expand All @@ -35,12 +37,13 @@ const NavListItem = styled(({ icon, children, ...rest }) => (
</ListItem>
))`
color: white;
&:hover:not([disabled]) {
background-color: rgba(15, 19, 26, 0.5);
}
&[disabled] {
pointer-events: none;
color: ${({ theme }) => theme.colors.n700};
${disableVisually()};
}
`;

Expand Down
2 changes: 1 addition & 1 deletion src/components/SideNav/components/List/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { BYTE, KILO, MEGA, GIGA } = sizes;

const listStyles = ({ theme, gutter }) => css`
margin: 0;
padding: ${theme.spacings[gutter]} ${theme.spacings[gutter]} 0;
padding: ${theme.spacings[gutter]};
`;

const List = styled(props => {
Expand Down

0 comments on commit e7ef881

Please sign in to comment.