mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
fix sidebar width (#2359)
This commit is contained in:
parent
b61dbbd718
commit
b9f55a3fbc
@ -10,7 +10,7 @@ import {
|
||||
useTheme,
|
||||
} from '@mui/material';
|
||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||
import { SidebarModal } from 'component/common/SidebarModal/SidebarModal';
|
||||
import { DynamicSidebarModal } from 'component/common/SidebarModal/SidebarModal';
|
||||
import { PageContent } from 'component/common/PageContent/PageContent';
|
||||
import { PageHeader } from 'component/common/PageHeader/PageHeader';
|
||||
import { CheckCircle, HelpOutline } from '@mui/icons-material';
|
||||
@ -31,6 +31,7 @@ interface IChangeRequestSidebarProps {
|
||||
const StyledPageContent = styled(PageContent)(({ theme }) => ({
|
||||
height: '100vh',
|
||||
overflow: 'auto',
|
||||
minWidth: '50vw',
|
||||
padding: theme.spacing(7.5, 6),
|
||||
[theme.breakpoints.down('md')]: {
|
||||
padding: theme.spacing(4, 2),
|
||||
@ -147,7 +148,11 @@ export const ChangeRequestSidebar: VFC<IChangeRequestSidebarProps> = ({
|
||||
|
||||
if (!loading && !draft) {
|
||||
return (
|
||||
<SidebarModal open={open} onClose={onClose} label="Review changes">
|
||||
<DynamicSidebarModal
|
||||
open={open}
|
||||
onClose={onClose}
|
||||
label="Review changes"
|
||||
>
|
||||
<StyledPageContent
|
||||
header={
|
||||
<PageHeader
|
||||
@ -160,12 +165,16 @@ export const ChangeRequestSidebar: VFC<IChangeRequestSidebarProps> = ({
|
||||
{/* FIXME: empty state */}
|
||||
<BackButton onClick={onClose}>Close</BackButton>
|
||||
</StyledPageContent>
|
||||
</SidebarModal>
|
||||
</DynamicSidebarModal>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<SidebarModal open={open} onClose={onClose} label="Review changes">
|
||||
<DynamicSidebarModal
|
||||
open={open}
|
||||
onClose={onClose}
|
||||
label="Review changes"
|
||||
>
|
||||
<StyledPageContent
|
||||
header={
|
||||
<PageHeader
|
||||
@ -343,6 +352,6 @@ export const ChangeRequestSidebar: VFC<IChangeRequestSidebarProps> = ({
|
||||
</Box>
|
||||
))}
|
||||
</StyledPageContent>
|
||||
</SidebarModal>
|
||||
</DynamicSidebarModal>
|
||||
);
|
||||
};
|
||||
|
@ -1,13 +1,14 @@
|
||||
import { ReactNode } from 'react';
|
||||
import { ReactNode, FC } from 'react';
|
||||
import { Modal, Backdrop, styled } from '@mui/material';
|
||||
import Fade from '@mui/material/Fade';
|
||||
import { SIDEBAR_MODAL_ID } from 'utils/testIds';
|
||||
import * as React from 'react';
|
||||
|
||||
interface ISidebarModalProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
label: string;
|
||||
children: ReactNode;
|
||||
children: React.ReactElement<any, any>;
|
||||
}
|
||||
|
||||
const TRANSITION_DURATION = 250;
|
||||
@ -19,17 +20,20 @@ const ModalContentWrapper = styled('div')({
|
||||
bottom: 0,
|
||||
height: '100vh',
|
||||
maxWidth: '98vw',
|
||||
width: 1300,
|
||||
overflow: 'auto',
|
||||
boxShadow: '0 0 1rem rgba(0, 0, 0, 0.25)',
|
||||
});
|
||||
|
||||
export const SidebarModal = ({
|
||||
const FixedWidthContentWrapper = styled(ModalContentWrapper)({
|
||||
width: 1300,
|
||||
});
|
||||
|
||||
export const BaseModal: FC<ISidebarModalProps> = ({
|
||||
open,
|
||||
onClose,
|
||||
label,
|
||||
children,
|
||||
}: ISidebarModalProps) => {
|
||||
}) => {
|
||||
return (
|
||||
<Modal
|
||||
open={open}
|
||||
@ -41,8 +45,26 @@ export const SidebarModal = ({
|
||||
data-testid={SIDEBAR_MODAL_ID}
|
||||
>
|
||||
<Fade timeout={TRANSITION_DURATION} in={open}>
|
||||
<ModalContentWrapper>{children}</ModalContentWrapper>
|
||||
{children}
|
||||
</Fade>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export const SidebarModal: FC<ISidebarModalProps> = props => {
|
||||
return (
|
||||
<BaseModal {...props}>
|
||||
<FixedWidthContentWrapper>
|
||||
{props.children}
|
||||
</FixedWidthContentWrapper>
|
||||
</BaseModal>
|
||||
);
|
||||
};
|
||||
|
||||
export const DynamicSidebarModal: FC<ISidebarModalProps> = props => {
|
||||
return (
|
||||
<BaseModal {...props}>
|
||||
<ModalContentWrapper>{props.children}</ModalContentWrapper>
|
||||
</BaseModal>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user