Skip to content

Commit 061dac5

Browse files
authored
fix(devenv): use content margin style for expanded side nav (#4886)
This change ensures that the fixed side nav stories make use of `margin-left` style for `.bx--content` with `.bx--side-nav--expanded` instead of using responsive left margin `v10` grid defines, so that the main content won't be hidden underneath the fixed side nav when fixed it's expanded. Fixes #3591.
1 parent 36b9762 commit 061dac5

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

packages/react/src/components/UIShell/UIShell-story.js

+18-11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
import cx from 'classnames';
9+
810
import { Search20, Notification20, AppSwitcher20 } from '@carbon/icons-react';
911

1012
import { storiesOf } from '@storybook/react';
@@ -56,11 +58,15 @@ const Fade16 = () => (
5658
</svg>
5759
);
5860

59-
const StoryContent = () => {
61+
const StoryContent = ({ useResponsiveOffset = true }) => {
62+
const classNameFirstColumn = cx({
63+
'bx--col-lg-13': true,
64+
'bx--offset-lg-3': useResponsiveOffset,
65+
});
6066
const content = (
6167
<div className="bx--grid">
6268
<div className="bx--row">
63-
<div className="bx--offset-lg-3 bx--col-lg-13">
69+
<div className={classNameFirstColumn}>
6470
<h2 style={{ fontWeight: '800', margin: '30px 0', fontSize: '20px' }}>
6571
Purpose and function
6672
</h2>
@@ -115,14 +121,15 @@ const StoryContent = () => {
115121
</div>
116122
</div>
117123
);
124+
const style = {
125+
height: '100%',
126+
};
127+
if (useResponsiveOffset) {
128+
style.margin = '0';
129+
style.width = '100%';
130+
}
118131
return (
119-
<Content
120-
id="main-content"
121-
style={{
122-
margin: '0',
123-
height: '100%',
124-
width: '100%',
125-
}}>
132+
<Content id="main-content" style={style}>
126133
{content}
127134
</Content>
128135
);
@@ -627,7 +634,7 @@ storiesOf('UI Shell', module)
627634
<SideNavLink href="javascript:void(0)">L0 link</SideNavLink>
628635
</SideNavItems>
629636
</SideNav>
630-
<StoryContent />
637+
<StoryContent useResponsiveOffset={false} />
631638
</>
632639
))
633640
)
@@ -669,7 +676,7 @@ storiesOf('UI Shell', module)
669676
</SideNavLink>
670677
</SideNavItems>
671678
</SideNav>
672-
<StoryContent />
679+
<StoryContent useResponsiveOffset={false} />
673680
</>
674681
))
675682
)

0 commit comments

Comments
 (0)