From 7aac2ef54931bcad6c22c93b81165057678ea073 Mon Sep 17 00:00:00 2001 From: Alperen Elhan Date: Mon, 17 Oct 2022 02:47:36 +0300 Subject: [PATCH] feat: restrict height of the manga metadata in details page --- src/components/chaptersTable.tsx | 5 + src/components/mangaDetail.tsx | 187 ++++++++++++++++++------------- src/pages/index.tsx | 5 +- src/pages/manga/[id].tsx | 2 +- 4 files changed, 117 insertions(+), 82 deletions(-) diff --git a/src/components/chaptersTable.tsx b/src/components/chaptersTable.tsx index 957cbf3..2749ddd 100644 --- a/src/components/chaptersTable.tsx +++ b/src/components/chaptersTable.tsx @@ -33,6 +33,11 @@ export function ChaptersTable({ manga }: { manga: MangaWithMetadataAndChaptersLi highlightOnHover records={records} recordsPerPage={PAGE_SIZE} + sx={(themes) => ({ + '*': { + fontSize: `${themes.fontSizes.xs}px !important`, + }, + })} page={page} totalRecords={manga.chapters.length} onPageChange={(p) => setPage(p)} diff --git a/src/components/mangaDetail.tsx b/src/components/mangaDetail.tsx index 0ce612a..5e6f255 100644 --- a/src/components/mangaDetail.tsx +++ b/src/components/mangaDetail.tsx @@ -1,8 +1,21 @@ -import { Badge, createStyles, Divider, Grid, Group, Image, Text, Title, Tooltip } from '@mantine/core'; +import { Badge, createStyles, Divider, Grid, Group, Image, Spoiler, Text, Title } from '@mantine/core'; +import { NextLink } from '@mantine/next'; import { Prisma } from '@prisma/client'; +import { IconExternalLink } from '@tabler/icons'; -const useStyles = createStyles((_theme) => ({ - root: {}, +const useStyles = createStyles((theme) => ({ + root: { + wordBreak: 'break-word', + }, + outsideLink: { + textDecoration: 'none', + fontWeight: 600, + color: theme.colors.blue[7], + '&:hover': { + color: theme.colors.indigo[7], + }, + fontSize: 24, + }, placeHolder: { alignItems: 'start !important', justifyContent: 'flex-start !important', @@ -19,83 +32,97 @@ export function MangaDetail({ manga }: { manga: MangaWithMetadataAndChapters }) const { classes } = useStyles(); return ( - - - ({ - width: 210, - boxShadow: theme.shadows.xl, - })} - withPlaceholder - placeholder={ - ({ - width: 210, - boxShadow: theme.shadows.xl, - })} - src="/cover-not-found.jpg" - alt={manga.title} - /> - } - src={manga.metadata.cover} - /> - - - {manga.title}} /> - - {manga.metadata.synonyms.map((synonym) => ( - -
- - {synonym} - -
-
- ))} -
- - - {manga.metadata.status} - - - - - There are   - - {manga.chapters.length} + } + hideLabel={} + > + + + ({ + width: 210, + boxShadow: theme.shadows.xl, + })} + withPlaceholder + placeholder={ + ({ + width: 210, + boxShadow: theme.shadows.xl, + })} + src="/cover-not-found.jpg" + alt={manga.title} + /> + } + src={manga.metadata.cover} + /> + + + url.includes('anilist')) ? ( + url.includes('anilist')) || '#'} + > + + {manga.title} + + + + ) : ( + + {manga.title} + + ) + } + /> + + {manga.metadata.synonyms.map((synonym) => ( + + {synonym} + + ))} + + + + {manga.metadata.status} -   chapters - - - {manga.metadata.summary || 'No summary...'} - - - {manga.metadata.genres.map((genre) => ( - -
- - {genre} - -
-
- ))} -
- - - {manga.metadata.tags.map((tag) => ( - -
- - {tag} - -
-
- ))} -
-
-
+ + + {manga.metadata.summary || 'No summary...'} + + + {manga.metadata.genres.map((genre) => ( + + {genre} + + ))} + + + + {manga.metadata.tags.map((tag) => ( + + {tag} + + ))} + + + + ); } diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 8d3ba54..6bc621a 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -97,7 +97,10 @@ export default function IndexPage() { title={manga.title} cover={manga.metadata.cover} onRemove={() => handleRemove(manga.id, manga.title)} - onClick={() => router.push(`/manga/${manga.id}`)} + onClick={() => { + mangaQuery.refetch(); + router.push(`/manga/${manga.id}`); + }} /> ); diff --git a/src/pages/manga/[id].tsx b/src/pages/manga/[id].tsx index 3cdf539..68d2316 100644 --- a/src/pages/manga/[id].tsx +++ b/src/pages/manga/[id].tsx @@ -4,7 +4,7 @@ import { ChaptersTable } from '../../components/chaptersTable'; import { MangaDetail } from '../../components/mangaDetail'; import { trpc } from '../../utils/trpc'; -export default function LibraryPage() { +export default function MangaPage() { const router = useRouter(); const { id } = router.query; const mangaQuery = trpc.manga.get.useQuery(