Skip to content

Commit e7ef881

Browse files
authored
Adjust SideNav-related components (#280)
Adjust SideNav-related components
1 parent 805e8cf commit e7ef881

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

src/components/Popover/Popover.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ import { toPopperPlacement, popperModifiers } from './PopoverService';
1919
const ReferenceWrapper = styled('div')`
2020
label: popover__button-wrapper;
2121
display: inline-block;
22+
2223
&:focus {
2324
outline: none;
2425
}
26+
27+
${({ referenceWrapperStyles, ...rest }) => referenceWrapperStyles(rest)};
2528
`;
2629

2730
const basePopoverWrapperStyles = ({ theme }) => css`
@@ -129,7 +132,11 @@ class Popover extends Component {
129132
usePortal: PropTypes.bool,
130133
modifiers: PropTypes.shape(),
131134
arrowRenderer: PropTypes.func,
132-
referenceElement: PropTypes.element
135+
referenceWrapperStyles: PropTypes.func,
136+
referenceElement: PropTypes.oneOfType([
137+
PropTypes.instanceOf(HTMLElement),
138+
PropTypes.element
139+
])
133140
};
134141

135142
static defaultProps = {
@@ -142,7 +149,8 @@ class Popover extends Component {
142149
modifiers: {},
143150
arrowRenderer: () => null,
144151
renderReference: () => null,
145-
referenceElement: null
152+
referenceElement: null,
153+
referenceWrapperStyles: () => null
146154
};
147155

148156
componentDidMount() {
@@ -186,6 +194,7 @@ class Popover extends Component {
186194
renderPopover,
187195
renderReference,
188196
referenceElement,
197+
referenceWrapperStyles,
189198
position,
190199
align,
191200
isOpen,
@@ -199,6 +208,7 @@ class Popover extends Component {
199208
<Reference>
200209
{({ ref }) => (
201210
<ReferenceWrapper
211+
referenceWrapperStyles={referenceWrapperStyles}
202212
innerRef={this.receiveButtonRef}
203213
onClick={this.handleReferenceClick}
204214
>

src/components/SideNav/SideNav.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
} from './components';
1111
import { childrenPropType } from '../../util/shared-prop-types';
1212

13+
import { disableVisually } from '../../styles/style-helpers';
14+
1315
export const COLLAPSED_NAV_WIDTH = 64;
1416
export const FULL_NAV_WIDTH = 270;
1517

@@ -35,12 +37,13 @@ const NavListItem = styled(({ icon, children, ...rest }) => (
3537
</ListItem>
3638
))`
3739
color: white;
40+
3841
&:hover:not([disabled]) {
3942
background-color: rgba(15, 19, 26, 0.5);
4043
}
44+
4145
&[disabled] {
42-
pointer-events: none;
43-
color: ${({ theme }) => theme.colors.n700};
46+
${disableVisually()};
4447
}
4548
`;
4649

src/components/SideNav/components/List/List.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { BYTE, KILO, MEGA, GIGA } = sizes;
77

88
const listStyles = ({ theme, gutter }) => css`
99
margin: 0;
10-
padding: ${theme.spacings[gutter]} ${theme.spacings[gutter]} 0;
10+
padding: ${theme.spacings[gutter]};
1111
`;
1212

1313
const List = styled(props => {

0 commit comments

Comments
 (0)