Skip to content

Commit

Permalink
Mobile landscape drawer open button
Browse files Browse the repository at this point in the history
Fixes #178
  • Loading branch information
andrew-codes committed Feb 9, 2024
1 parent 9cec614 commit ec9a128
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { FC, PropsWithChildren, ReactNode, useState } from 'react'
import IconButton from '../IconButton'
import MainNavigation from './MainNavigation'

const drawerWidth = 320
const drawerWidth = 296
const openedMixin = (theme: Theme, additionalWidth: number = 0): CSSObject => ({
width: `calc(${drawerWidth}px + ${additionalWidth}px)`,
transition: theme.transitions.create('width', {
Expand Down Expand Up @@ -42,7 +42,10 @@ const AppBar = styled(MuiAppBar, {
// position: 'unset',
width: `calc(100% + 15px)`,
'& .MuiToolbar-root': {
marginLeft: `${drawerWidth - 60}px`,
marginLeft: `${drawerWidth - 24 - 24 - 2}px`,
[theme.breakpoints.down('sm')]: {
marginLeft: `${drawerWidth - 16 - 16 - 2}px`,
},
zIndex: 1800,
transition: theme.transitions.create(['margin'], {
easing: theme.transitions.easing.easeOut,
Expand Down Expand Up @@ -122,7 +125,7 @@ const DrawerHeader = styled(AppBarHeader, {
shouldForwardProp: (prop) => prop !== 'open',
})<{ open: boolean }>(({ open, theme }) => ({
position: 'absolute',
right: '-24px',
right: '-22px',
...(!open && {
display: 'none',
}),
Expand All @@ -139,7 +142,7 @@ const DrawerBody = styled('div', {
paddingTop: `56px`,
backgroundColor: theme.palette.background.paper,
...(open && {
...openedMixin(theme, -24),
...openedMixin(theme),
transition: theme.transitions.create(['background', 'width'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
Expand Down

0 comments on commit ec9a128

Please sign in to comment.