From c9cf516473fc69195571843e2dd35ae86baa29ee Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Thu, 23 May 2024 00:40:20 +0200 Subject: [PATCH] Use Typography in MangaDetails --- src/components/atoms/Metadata.tsx | 34 +++++++++++++++++++++ src/components/manga/MangaDetails.tsx | 33 +++++++++++--------- src/components/tracker/TrackerMangaCard.tsx | 16 +++------- 3 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 src/components/atoms/Metadata.tsx diff --git a/src/components/atoms/Metadata.tsx b/src/components/atoms/Metadata.tsx new file mode 100644 index 00000000..8192e2e0 --- /dev/null +++ b/src/components/atoms/Metadata.tsx @@ -0,0 +1,34 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import Stack, { StackProps } from '@mui/material/Stack'; +import Typography, { TypographyProps } from '@mui/material/Typography'; + +export const Metadata = ({ + title, + value, + stackProps, + titleProps, + valueProps, +}: { + title: string; + value: string; + stackProps?: StackProps; + titleProps?: TypographyProps; + valueProps?: TypographyProps; +}) => ( + + {title} + + {value} + + +); diff --git a/src/components/manga/MangaDetails.tsx b/src/components/manga/MangaDetails.tsx index a4c9981b..a6d42b37 100644 --- a/src/components/manga/MangaDetails.tsx +++ b/src/components/manga/MangaDetails.tsx @@ -10,10 +10,11 @@ import FavoriteIcon from '@mui/icons-material/Favorite'; import FavoriteBorderIcon from '@mui/icons-material/FavoriteBorder'; import PublicIcon from '@mui/icons-material/Public'; import { styled } from '@mui/material/styles'; -import React, { useEffect, useMemo } from 'react'; +import React, { ComponentProps, useEffect, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { t as translate } from 'i18next'; import Link from '@mui/material/Link'; +import Typography from '@mui/material/Typography'; import { ISource, TManga } from '@/typings'; import { makeToast } from '@/components/util/Toast'; import { Mangas } from '@/lib/data/Mangas.ts'; @@ -21,6 +22,7 @@ import { SpinnerImage } from '@/components/util/SpinnerImage.tsx'; import { CustomIconButton } from '@/components/atoms/CustomIconButton'; import { TrackMangaButton } from '@/components/manga/TrackMangaButton.tsx'; import { useManageMangaLibraryState } from '@/components/manga/useManageMangaLibraryState.tsx'; +import { Metadata as BaseMetadata } from '@/components/atoms/Metadata.tsx'; const DetailsWrapper = styled('div')(({ theme }) => ({ width: '100%', @@ -59,7 +61,7 @@ const Thumbnail = styled('div')(() => ({ // }, })); -const Metadata = styled('div')(({ theme }) => ({ +const MetadataContainer = styled('div')(({ theme }) => ({ marginLeft: 15, maxWidth: '100%', '& span': { @@ -69,6 +71,11 @@ const Metadata = styled('div')(({ theme }) => ({ fontSize: '1.3em', }, })); + +const Metadata = (props: ComponentProps) => ( + +); + const MangaButtonsContainer = styled('div')(({ theme }) => ({ display: 'flex', justifyContent: 'space-around', @@ -181,19 +188,15 @@ export const MangaDetails: React.FC = ({ manga }) => { - -

{manga.title}

-

- {`${t('manga.label.author')}: `} - {getValueOrUnknown(manga.author)} -

-

- {`${t('manga.label.artist')}: `} - {getValueOrUnknown(manga.artist)} -

-

{`${t('manga.label.status')}: ${manga.status}`}

-

{`${t('source.title')}: ${getSourceName(manga.source)}`}

-
+ + + {manga.title} + + + + + + ( @@ -39,15 +40,6 @@ const TrackerMangaCardTitle = ({ title, selected }: { title: string; selected: b ); -const TrackerMangaCardInfo = ({ title, value }: { title: string; value: string }) => ( - - {title} - - {value} - - -); - const SUMMARY_COLLAPSED_SIZE = 50; const TrackerMangaCardSummary = ({ summary }: { summary: string }) => { const { t } = useTranslation(); @@ -164,9 +156,9 @@ export const TrackerMangaCard = ({ - - - + + +