Update reader nav bar styling

This commit is contained in:
schroda
2024-09-01 00:11:28 +02:00
parent 1414f2f103
commit c5f83cec53

View File

@@ -36,6 +36,7 @@ import { ChapterType } from '@/lib/graphql/generated/graphql.ts';
import { MangaChapterCountInfo, MangaIdInfo } from '@/lib/data/Mangas.ts'; import { MangaChapterCountInfo, MangaIdInfo } from '@/lib/data/Mangas.ts';
import { useNavBarContext } from '@/components/context/NavbarContext.tsx'; import { useNavBarContext } from '@/components/context/NavbarContext.tsx';
import { useResizeObserver } from '@/util/useResizeObserver.tsx'; import { useResizeObserver } from '@/util/useResizeObserver.tsx';
import { CustomIconButton } from '@/components/atoms/CustomIconButton.tsx';
const Root = styled('div')({ const Root = styled('div')({
zIndex: 10, zIndex: 10,
@@ -55,36 +56,15 @@ const NavContainer = styled('div')(({ theme }) => ({
backgroundColor: theme.palette.action.hover, backgroundColor: theme.palette.action.hover,
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
minHeight: '64px', padding: `${theme.spacing(1)} ${theme.spacing(3)}`,
paddingLeft: '24px',
paddingRight: '24px',
transition: 'left 2s ease', transition: 'left 2s ease',
'& button': {
flexGrow: 0,
flexShrink: 0,
},
'& button:nth-child(1)': {
marginRight: '16px',
},
'& h1': {
fontSize: '1.25rem',
flexGrow: 1,
},
}, },
})); }));
const Navigation = styled('div')({ const Navigation = styled('div')(({ theme }) => ({
margin: '0 16px', margin: `0 ${theme.spacing(2)}`,
'& > span:nth-child(1)': { }));
textAlign: 'center',
display: 'block',
marginTop: '16px',
},
});
const PageNavigation = styled('div')({ const PageNavigation = styled('div')({
display: 'flex', display: 'flex',
@@ -94,13 +74,13 @@ const PageNavigation = styled('div')({
justifyContent: 'center', justifyContent: 'center',
}); });
const ChapterNavigation = styled('div')({ const ChapterNavigation = styled('div')(({ theme }) => ({
display: 'grid', display: 'grid',
gridTemplateRows: 'auto auto auto', gridTemplateRows: 'auto auto auto',
gridTemplateColumns: '0fr 1fr 0fr', gridTemplateColumns: '0fr 1fr 0fr',
gridTemplateAreas: '"pre current next"', gridTemplateAreas: '"pre current next"',
gridColumnGap: '5px', gridColumnGap: theme.spacing(0.5),
margin: '10px 0', margin: `${theme.spacing(1)} 0`,
'& a': { '& a': {
textDecoration: 'none', textDecoration: 'none',
@@ -109,19 +89,6 @@ const ChapterNavigation = styled('div')({
flexWrap: 'wrap', flexWrap: 'wrap',
alignContent: 'center', alignContent: 'center',
}, },
});
const OpenDrawerButton = styled(IconButton)(({ theme }) => ({
position: 'fixed',
top: 0 + 20,
left: 10 + 20,
height: '40px',
width: '40px',
borderRadius: 5,
backgroundColor: theme.palette.custom.main,
'&:hover': {
backgroundColor: theme.palette.custom.light,
},
})); }));
interface IProps { interface IProps {
@@ -256,7 +223,13 @@ export function ReaderNavBar(props: IProps) {
</IconButton> </IconButton>
</Tooltip> </Tooltip>
)} )}
<Typography variant="h1" textOverflow="ellipsis" overflow="hidden" sx={{ py: 1 }}> <Typography
variant="h6"
component="h1"
textOverflow="ellipsis"
overflow="hidden"
sx={{ py: 1, flexGrow: 1 }}
>
{chapter.name} {chapter.name}
</Typography> </Typography>
<Tooltip title={t('reader.button.exit')}> <Tooltip title={t('reader.button.exit')}>
@@ -314,7 +287,7 @@ export function ReaderNavBar(props: IProps) {
<span>{t('reader.page_info.label.currently_on_page')}</span> <span>{t('reader.page_info.label.currently_on_page')}</span>
<FormControl <FormControl
size="small" size="small"
sx={{ margin: '0 5px' }} sx={{ mx: 0.5 }}
disabled={disableChapterNavButtons || chapter.pageCount === -1} disabled={disableChapterNavButtons || chapter.pageCount === -1}
> >
<Select <Select
@@ -392,16 +365,18 @@ export function ReaderNavBar(props: IProps) {
<Zoom in={!drawerOpen}> <Zoom in={!drawerOpen}>
<Fade in={!hideOpenButton}> <Fade in={!hideOpenButton}>
<Tooltip title={t('reader.button.open_menu')}> <Tooltip title={t('reader.button.open_menu')}>
<OpenDrawerButton <CustomIconButton
edge="start" sx={{
aria-label="menu" position: 'fixed',
disableRipple top: 20,
disableFocusRipple left: 20,
onClick={() => updateDrawer(true)} }}
size="large" size="large"
variant="contained"
onClick={() => updateDrawer(true)}
> >
{getOptionForDirection(<KeyboardArrowRightIcon />, <KeyboardArrowLeftIcon />)} {getOptionForDirection(<KeyboardArrowRightIcon />, <KeyboardArrowLeftIcon />)}
</OpenDrawerButton> </CustomIconButton>
</Tooltip> </Tooltip>
</Fade> </Fade>
</Zoom> </Zoom>