Update manga cards styling

This commit is contained in:
schroda
2024-08-30 21:19:40 +02:00
parent 37d6f35604
commit 299d3c111c
4 changed files with 43 additions and 47 deletions

View File

@@ -35,7 +35,7 @@ export const ContinueReadingButton = ({
<Button <Button
variant="contained" variant="contained"
size="small" size="small"
sx={{ minWidth: 'unset' }} sx={{ minWidth: 'unset', py: 0.5, px: 0.75 }}
component={Link} component={Link}
to={`${mangaLinkTo}chapter/${nextChapterIndexToRead}`} to={`${mangaLinkTo}chapter/${nextChapterIndexToRead}`}
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}

View File

@@ -14,18 +14,17 @@ import { useLibraryOptionsContext } from '@/components/context/LibraryOptionsCon
import { MangaCardMode } from '@/components/manga/MangaCard.types.tsx'; import { MangaCardMode } from '@/components/manga/MangaCard.types.tsx';
import { MediaQuery } from '@/lib/ui/MediaQuery.tsx'; import { MediaQuery } from '@/lib/ui/MediaQuery.tsx';
const BadgeContainer = styled('div')({ const BadgeContainer = styled('div')(({ theme }) => ({
display: 'flex', display: 'flex',
height: 'fit-content', height: 'fit-content',
borderRadius: '5px', borderRadius: theme.shape.borderRadius,
overflow: 'hidden', overflow: 'hidden',
'& p': { }));
color: 'white',
padding: '0.1em', const Badge = styled(Typography)(({ theme }) => ({
paddingInline: '0.2em', color: theme.palette.primary.contrastText,
fontSize: '1.05rem', paddingInline: theme.spacing(0.3),
}, }));
});
export const MangaBadges = ({ export const MangaBadges = ({
inLibraryIndicator, inLibraryIndicator,
@@ -78,16 +77,16 @@ export const MangaBadges = ({
</Typography> </Typography>
)} )}
{((showUnreadBadge && mode === 'default') || mode === 'duplicate') && (unread ?? 0) > 0 && ( {((showUnreadBadge && mode === 'default') || mode === 'duplicate') && (unread ?? 0) > 0 && (
<Typography sx={{ backgroundColor: 'primary.dark' }}>{unread}</Typography> <Badge sx={{ backgroundColor: 'primary.dark' }}>{unread}</Badge>
)} )}
{((showDownloadBadge && mode === 'default') || mode === 'duplicate') && (downloadCount ?? 0) > 0 && ( {((showDownloadBadge && mode === 'default') || mode === 'duplicate') && (downloadCount ?? 0) > 0 && (
<Typography <Badge
sx={{ sx={{
backgroundColor: 'success.dark', backgroundColor: 'primary.light',
}} }}
> >
{downloadCount} {downloadCount}
</Typography> </Badge>
)} )}
</BadgeContainer> </BadgeContainer>
); );

View File

@@ -18,9 +18,9 @@ import { useRef } from 'react';
import { SpinnerImage } from '@/components/util/SpinnerImage.tsx'; import { SpinnerImage } from '@/components/util/SpinnerImage.tsx';
import { MangaOptionButton } from '@/components/manga/MangaOptionButton.tsx'; import { MangaOptionButton } from '@/components/manga/MangaOptionButton.tsx';
import { GridLayout } from '@/components/context/LibraryOptionsContext.tsx'; import { GridLayout } from '@/components/context/LibraryOptionsContext.tsx';
import { TypographyMaxLines } from '@/components/atoms/TypographyMaxLines.tsx';
import { Mangas } from '@/lib/data/Mangas.ts'; import { Mangas } from '@/lib/data/Mangas.ts';
import { SpecificMangaCardProps } from '@/components/manga/MangaCard.types.tsx'; import { SpecificMangaCardProps } from '@/components/manga/MangaCard.types.tsx';
import { TypographyMaxLines } from '@/components/atoms/TypographyMaxLines';
const BottomGradient = styled('div')({ const BottomGradient = styled('div')({
position: 'absolute', position: 'absolute',
@@ -38,10 +38,6 @@ const BottomGradientDoubledDown = styled('div')({
background: 'linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%)', background: 'linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%)',
}); });
const GridMangaTitle = styled(TypographyMaxLines)({
fontSize: '1.05rem',
});
export const MangaGridCard = ({ export const MangaGridCard = ({
manga, manga,
longPressBind, longPressBind,
@@ -74,7 +70,7 @@ export const MangaGridCard = ({
sx={{ sx={{
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
margin: '2px', m: 0.25,
outline: selected ? '4px solid' : undefined, outline: selected ? '4px solid' : undefined,
borderRadius: selected ? '1px' : undefined, borderRadius: selected ? '1px' : undefined,
outlineColor: (theme) => theme.palette.primary.main, outlineColor: (theme) => theme.palette.primary.main,
@@ -134,9 +130,9 @@ export const MangaGridCard = ({
direction="row" direction="row"
sx={{ sx={{
position: 'absolute', position: 'absolute',
top: 5, top: (theme) => theme.spacing(1),
left: 5, left: (theme) => theme.spacing(1),
right: 5, right: (theme) => theme.spacing(1),
}} }}
> >
{mangaBadges} {mangaBadges}
@@ -163,21 +159,21 @@ export const MangaGridCard = ({
position: 'absolute', position: 'absolute',
bottom: 0, bottom: 0,
width: '100%', width: '100%',
margin: '0.5em 0', p: 1,
padding: '0 0.5em', gap: 1,
gap: '0.5em',
}} }}
> >
{gridLayout !== GridLayout.Comfortable && ( {gridLayout !== GridLayout.Comfortable && (
<Tooltip title={title} placement="top"> <Tooltip title={title} placement="top">
<GridMangaTitle <TypographyMaxLines
component="h3"
sx={{ sx={{
color: 'white', color: 'white',
textShadow: '0px 0px 3px #000000', textShadow: '0px 0px 3px #000000',
}} }}
> >
{title} {title}
</GridMangaTitle> </TypographyMaxLines>
</Tooltip> </Tooltip>
)} )}
{continueReadingButton} {continueReadingButton}
@@ -186,21 +182,20 @@ export const MangaGridCard = ({
</CardActionArea> </CardActionArea>
</Card> </Card>
{gridLayout === GridLayout.Comfortable && ( {gridLayout === GridLayout.Comfortable && (
<Stack sx={{ pb: 1 }}>
<Tooltip title={title} placement="top"> <Tooltip title={title} placement="top">
<GridMangaTitle <TypographyMaxLines
component="h3"
sx={{ sx={{
position: 'relative',
width: '100%',
bottom: 0,
margin: '0.5em 0',
padding: '0 0.5em',
color: 'text.primary', color: 'text.primary',
height: '3rem', height: '3rem',
pt: 0.5,
}} }}
> >
{title} {title}
</GridMangaTitle> </TypographyMaxLines>
</Tooltip> </Tooltip>
</Stack>
)} )}
</Box> </Box>
</Link> </Link>

View File

@@ -68,7 +68,7 @@ export const MangaListCard = ({
display: 'flex', display: 'flex',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center', alignItems: 'center',
padding: 2, padding: 1.5,
position: 'relative', position: 'relative',
}} }}
> >
@@ -78,7 +78,7 @@ export const MangaListCard = ({
width: 56, width: 56,
height: 56, height: 56,
flex: '0 0 auto', flex: '0 0 auto',
marginRight: 2, marginRight: 1,
}} }}
> >
<SpinnerImage <SpinnerImage
@@ -103,10 +103,12 @@ export const MangaListCard = ({
}} }}
> >
<Tooltip title={title} placement="top"> <Tooltip title={title} placement="top">
<TypographyMaxLines variant="h5">{title}</TypographyMaxLines> <TypographyMaxLines variant="h6" component="h3">
{title}
</TypographyMaxLines>
</Tooltip> </Tooltip>
</Box> </Box>
<Stack direction="row" alignItems="center" gap="5px"> <Stack direction="row" alignItems="center" gap={0.5}>
{mangaBadges} {mangaBadges}
{continueReadingButton} {continueReadingButton}
<MangaOptionButton <MangaOptionButton