Skip to content

Commit

Permalink
fix(UIShell): fix overlay issue with modal in content (#7891)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
tw15egan and kodiakhq[bot] authored Mar 2, 2021
1 parent ba8501e commit 4cd729f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/components/src/components/ui-shell/_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
.#{$prefix}--content {
padding: 2rem;
background: $ui-02;
transform: translate3d(0, 0, 0);
will-change: margin-left;
}

Expand Down
5 changes: 3 additions & 2 deletions packages/components/src/components/ui-shell/_side-nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@
}

.#{$prefix}--side-nav__overlay {
position: absolute;
position: fixed;
top: rem(48px);
left: 0;
width: 0;
height: 0;
background-color: transparent;
Expand All @@ -128,7 +129,7 @@

.#{$prefix}--side-nav__overlay-active {
@include carbon--breakpoint-down('lg') {
width: 100%;
width: 100vw;
height: 100vh;
background-color: $overlay-01;
opacity: 1;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/UIShell/SideNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const SideNav = React.forwardRef(function SideNav(props, ref) {

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

let childrenToRender = children;
Expand Down
20 changes: 19 additions & 1 deletion packages/react/src/components/UIShell/UIShell-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Search20, Notification20, AppSwitcher20 } from '@carbon/icons-react';

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

import React from 'react';
import React, { useState } from 'react';
import { withReadme } from 'storybook-readme';
import readme from './README.md';
import HeaderContainer from './HeaderContainer';
Expand Down Expand Up @@ -42,6 +42,9 @@ import {
SwitcherItem,
SwitcherDivider,
} from '../UIShell';
import Modal from '../Modal';
import Button from '../Button';

import mdx from './UIShell.mdx';

SideNav.displayName = 'SideNav';
Expand All @@ -60,6 +63,7 @@ const Fade16 = () => (
);

const StoryContent = ({ useResponsiveOffset = true }) => {
const [open, setOpen] = useState(false);
const classNameFirstColumn = cx({
'bx--col-lg-13': true,
'bx--offset-lg-3': useResponsiveOffset,
Expand Down Expand Up @@ -112,6 +116,20 @@ const StoryContent = ({ useResponsiveOffset = true }) => {
on a page when using a side-nav, then the tabs are secondary in
hierarchy to the side-nav.
</p>
<Button onClick={() => setOpen(true)}>Launch modal</Button>
<Modal
modalHeading="Add a custom domain"
modalLabel="Account resources"
primaryButtonText="Add"
secondaryButtonText="Cancel"
open={open}
onRequestClose={() => setOpen(false)}>
<p style={{ marginBottom: '1rem' }}>
Custom domains direct requests for your apps in this Cloud Foundry
organization to a URL that you own. A custom domain can be a
shared domain, a shared subdomain, or a shared domain and host.
</p>
</Modal>
</div>
</div>
</div>
Expand Down

0 comments on commit 4cd729f

Please sign in to comment.