Skip to content

Commit 4cd729f

Browse files
fix(UIShell): fix overlay issue with modal in content (#7891)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent ba8501e commit 4cd729f

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

packages/components/src/components/ui-shell/_content.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
.#{$prefix}--content {
1717
padding: 2rem;
1818
background: $ui-02;
19-
transform: translate3d(0, 0, 0);
2019
will-change: margin-left;
2120
}
2221

packages/components/src/components/ui-shell/_side-nav.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@
116116
}
117117

118118
.#{$prefix}--side-nav__overlay {
119-
position: absolute;
119+
position: fixed;
120120
top: rem(48px);
121+
left: 0;
121122
width: 0;
122123
height: 0;
123124
background-color: transparent;
@@ -128,7 +129,7 @@
128129

129130
.#{$prefix}--side-nav__overlay-active {
130131
@include carbon--breakpoint-down('lg') {
131-
width: 100%;
132+
width: 100vw;
132133
height: 100vh;
133134
background-color: $overlay-01;
134135
opacity: 1;

packages/react/src/components/UIShell/SideNav.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const SideNav = React.forwardRef(function SideNav(props, ref) {
7474

7575
const overlayClassName = cx({
7676
[`${prefix}--side-nav__overlay`]: true,
77-
[`${prefix}--side-nav__overlay-active`]: expanded,
77+
[`${prefix}--side-nav__overlay-active`]: expanded || expandedViaHoverState,
7878
});
7979

8080
let childrenToRender = children;

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Search20, Notification20, AppSwitcher20 } from '@carbon/icons-react';
1111

1212
import { action } from '@storybook/addon-actions';
1313

14-
import React from 'react';
14+
import React, { useState } from 'react';
1515
import { withReadme } from 'storybook-readme';
1616
import readme from './README.md';
1717
import HeaderContainer from './HeaderContainer';
@@ -42,6 +42,9 @@ import {
4242
SwitcherItem,
4343
SwitcherDivider,
4444
} from '../UIShell';
45+
import Modal from '../Modal';
46+
import Button from '../Button';
47+
4548
import mdx from './UIShell.mdx';
4649

4750
SideNav.displayName = 'SideNav';
@@ -60,6 +63,7 @@ const Fade16 = () => (
6063
);
6164

6265
const StoryContent = ({ useResponsiveOffset = true }) => {
66+
const [open, setOpen] = useState(false);
6367
const classNameFirstColumn = cx({
6468
'bx--col-lg-13': true,
6569
'bx--offset-lg-3': useResponsiveOffset,
@@ -112,6 +116,20 @@ const StoryContent = ({ useResponsiveOffset = true }) => {
112116
on a page when using a side-nav, then the tabs are secondary in
113117
hierarchy to the side-nav.
114118
</p>
119+
<Button onClick={() => setOpen(true)}>Launch modal</Button>
120+
<Modal
121+
modalHeading="Add a custom domain"
122+
modalLabel="Account resources"
123+
primaryButtonText="Add"
124+
secondaryButtonText="Cancel"
125+
open={open}
126+
onRequestClose={() => setOpen(false)}>
127+
<p style={{ marginBottom: '1rem' }}>
128+
Custom domains direct requests for your apps in this Cloud Foundry
129+
organization to a URL that you own. A custom domain can be a
130+
shared domain, a shared subdomain, or a shared domain and host.
131+
</p>
132+
</Modal>
115133
</div>
116134
</div>
117135
</div>

0 commit comments

Comments
 (0)