Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(UIShell): fix overlay issue with modal in content #7891

Merged
merged 3 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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