-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create layout container for the pages
- Loading branch information
Artur Santiago
committed
Oct 14, 2021
1 parent
830970c
commit edf4fc6
Showing
4 changed files
with
50 additions
and
0 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
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
41 changes: 41 additions & 0 deletions
41
src/components/PageLayoutContainer/PageLayoutContainer.tsx
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { | ||
Grid, Theme, useMediaQuery, useTheme, | ||
} from '@material-ui/core'; | ||
import { makeStyles } from '@material-ui/styles'; | ||
import clsx from 'clsx'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => ({ | ||
rootContainer: { | ||
position: 'fixed', | ||
width: 'calc(100% - 280px)', | ||
right: 0, | ||
top: 104, | ||
padding: theme.spacing(3), | ||
transition: 'width 0.2s ease', | ||
}, | ||
rootContainerExtended: { | ||
width: `calc(100% - ${theme.spacing(9)}px)`, | ||
[theme.breakpoints.down('sm')]: { | ||
width: '100%', | ||
}, | ||
}, | ||
})); | ||
|
||
export const PageLayoutContainer = ({ | ||
isNavigationCollapsed, | ||
children, | ||
}: PageLayoutContainer.Props): JSX.Element => { | ||
const classes = useStyles(); | ||
const theme = useTheme(); | ||
const matchesSmallSize = useMediaQuery(theme.breakpoints.down('sm')); | ||
|
||
return ( | ||
<Grid | ||
container | ||
className={clsx(classes.rootContainer, | ||
(matchesSmallSize || isNavigationCollapsed) && classes.rootContainerExtended)} | ||
> | ||
{children} | ||
</Grid> | ||
); | ||
}; |
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,3 +1,4 @@ | ||
export { MenuItem } from './MenuItem/MenuItem'; | ||
export { Navigation } from './Navigation/Navigation'; | ||
export { Header } from './Header/Header'; | ||
export { PageLayoutContainer } from './PageLayoutContainer/PageLayoutContainer'; |