-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
89 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export const APP_BAR_HEIGHT = 75; | ||
export const APP_BAR_HEIGHT = 66; | ||
|
||
export const SIDEBAR_DRAWER_WIDTH = 256; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,53 @@ | ||
import { AppBar, Container, LinearProgress } from '@mui/material'; | ||
import { AppBar, Box, Container, LinearProgress, Toolbar } from '@mui/material'; | ||
import { type PropsWithChildren, type FC, type ReactElement } from 'react'; | ||
import { APP_BAR_HEIGHT, SIDEBAR_DRAWER_WIDTH } from '../constants'; | ||
|
||
interface Props extends PropsWithChildren { | ||
withNavigationProgress: boolean; | ||
withAdditionalNavigation?: boolean; | ||
withSidebar?: boolean; | ||
header?: ReactElement; | ||
} | ||
|
||
export const AppShell: FC<Props> = ({ | ||
children, | ||
withNavigationProgress, | ||
withAdditionalNavigation, | ||
withSidebar, | ||
header, | ||
}) => ( | ||
<> | ||
{header && ( | ||
<AppBar position="sticky"> | ||
<Container>{header}</Container> | ||
<AppBar variant="outlined"> | ||
<Box component={Toolbar} disableGutters px={{ xs: 1, sm: 2, md: 1 }}> | ||
{header} | ||
</Box> | ||
</AppBar> | ||
)} | ||
{withNavigationProgress && ( | ||
<LinearProgress | ||
sx={{ | ||
position: 'absolute', | ||
top: 0, | ||
top: APP_BAR_HEIGHT, | ||
width: '100%', | ||
}} | ||
/> | ||
)} | ||
<Container | ||
<Box | ||
component="main" | ||
sx={theme => ({ | ||
paddingTop: withAdditionalNavigation ? 0 : theme.spacing(3), | ||
paddingBottom: theme.spacing(3), | ||
})} | ||
pt={withAdditionalNavigation ? 0 : 3} | ||
pb={3} | ||
ml={{ | ||
xs: 0, | ||
md: withSidebar ? `${SIDEBAR_DRAWER_WIDTH}px` : 0, | ||
}} | ||
width={{ | ||
xs: '100%', | ||
md: withSidebar ? `calc(100% - ${SIDEBAR_DRAWER_WIDTH}px)` : '100%', | ||
}} | ||
> | ||
{children} | ||
</Container> | ||
{header && <Toolbar />} | ||
<Container>{children}</Container> | ||
</Box> | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters