From 825fd46ed46c81b8161b6bb074be58a17e25d0c7 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Fri, 30 Aug 2024 03:36:38 +0200 Subject: [PATCH] Option to open manga page thumbnail fullscreen --- src/components/manga/MangaDetails.tsx | 86 +++++++++++++++++++++------ 1 file changed, 67 insertions(+), 19 deletions(-) diff --git a/src/components/manga/MangaDetails.tsx b/src/components/manga/MangaDetails.tsx index 823d54e4..d590e6c3 100644 --- a/src/components/manga/MangaDetails.tsx +++ b/src/components/manga/MangaDetails.tsx @@ -8,7 +8,7 @@ import FavoriteIcon from '@mui/icons-material/Favorite'; import FavoriteBorderIcon from '@mui/icons-material/FavoriteBorder'; -import { styled } from '@mui/material/styles'; +import { styled, useTheme } from '@mui/material/styles'; import { ComponentProps, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { t as translate } from 'i18next'; @@ -23,6 +23,9 @@ import Stack from '@mui/material/Stack'; import IconButton from '@mui/material/IconButton'; import ExpandLessIcon from '@mui/icons-material/ExpandLess'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; +import OpenInFullIcon from '@mui/icons-material/OpenInFull'; +import Modal from '@mui/material/Modal'; +import { bindPopover, bindTrigger, usePopupState } from 'material-ui-popup-state/hooks'; import { makeToast } from '@/components/util/Toast'; import { Mangas, MangaThumbnailInfo, MangaTrackRecordInfo } from '@/lib/data/Mangas.ts'; import { SpinnerImage } from '@/components/util/SpinnerImage.tsx'; @@ -48,22 +51,9 @@ const DetailsWrapper = styled('div')(({ theme }) => ({ const TopContentWrapper = styled('div')(() => ({})); -const ThumbnailMetadataWrapper = styled('div')(() => ({ +const ThumbnailMetadataWrapper = styled('div')(({ theme }) => ({ display: 'flex', -})); - -const Thumbnail = styled('div')(({ theme }) => ({ - '& img': { - borderRadius: 4, - width: '150px', - height: 'auto', - [theme.breakpoints.up('lg')]: { - width: '200px', - }, - [theme.breakpoints.up('xl')]: { - width: '300px', - }, - }, + paddingBottom: theme.spacing(1), })); const MetadataContainer = styled('div')(({ theme }) => ({ @@ -109,6 +99,66 @@ function getValueOrUnknown(val?: string | null) { return val ?? translate('global.label.unknown'); } +const Thumbnail = ({ manga }: { manga: Partial }) => { + const theme = useTheme(); + + const popupState = usePopupState({ variant: 'popover', popupId: 'manga-thumbnail-fullscreen' }); + + return ( + <> + + + + + + + + popupState.close()} + sx={{ height: '100vh', py: 2, outline: 0, justifyContent: 'center', alignItems: 'center' }} + > + + + + + ); +}; + const DESCRIPTION_COLLAPSED_SIZE = 75; const DescriptionGenre = ({ manga: { description, genre: genres }, @@ -194,9 +244,7 @@ export const MangaDetails = ({ - - - +