From a82bc74baad8ecfc10380097e4910288ac0d8c48 Mon Sep 17 00:00:00 2001 From: DrMint Date: Fri, 13 May 2022 19:24:25 +0200 Subject: [PATCH] Renamed ThumbnailPreview to PreviewCard + removed Next/Image --- src/components/Img.tsx | 17 ++++++----------- src/components/Markdown/Markdawn.tsx | 2 -- src/components/PreviewCard.tsx | 7 +++---- src/components/ThumbnailHeader.tsx | 1 - src/pages/archives/videos/c/[uid].tsx | 4 ++-- src/pages/archives/videos/index.tsx | 4 ++-- src/pages/contents/index.tsx | 4 ++-- src/pages/library/[slug]/index.tsx | 17 +++++------------ src/pages/news/index.tsx | 4 ++-- 9 files changed, 22 insertions(+), 38 deletions(-) diff --git a/src/components/Img.tsx b/src/components/Img.tsx index 5005aa1..3ee57a4 100644 --- a/src/components/Img.tsx +++ b/src/components/Img.tsx @@ -1,16 +1,13 @@ import { UploadImageFragment } from "graphql/generated"; import { getAssetURL, getImgSizesByQuality, ImageQuality } from "helpers/img"; import { Immutable } from "helpers/types"; -import Image, { ImageProps } from "next/image"; +import { ImageProps } from "next/image"; interface Props { className?: string; image?: UploadImageFragment | string; quality?: ImageQuality; alt?: ImageProps["alt"]; - layout?: ImageProps["layout"]; - objectFit?: ImageProps["objectFit"]; - priority?: ImageProps["priority"]; } export default function Img(props: Immutable): JSX.Element { @@ -20,6 +17,7 @@ export default function Img(props: Immutable): JSX.Element { className={props.className} src={props.image} alt={props.alt ?? ""} + loading="lazy" /> ); } else if (props.image?.width && props.image.height) { @@ -29,19 +27,16 @@ export default function Img(props: Immutable): JSX.Element { props.quality ?? ImageQuality.Small ); return ( - {props.alt ); } diff --git a/src/components/Markdown/Markdawn.tsx b/src/components/Markdown/Markdawn.tsx index cf87363..e042c5e 100644 --- a/src/components/Markdown/Markdawn.tsx +++ b/src/components/Markdown/Markdawn.tsx @@ -270,8 +270,6 @@ export default function Markdawn(props: Immutable): JSX.Element { ? getAssetURL(compProps.src, ImageQuality.Small) : compProps.src } - layout="fill" - objectFit="contain" quality={ImageQuality.Medium} > diff --git a/src/components/PreviewCard.tsx b/src/components/PreviewCard.tsx index ae723e0..45a02e3 100644 --- a/src/components/PreviewCard.tsx +++ b/src/components/PreviewCard.tsx @@ -44,7 +44,7 @@ interface Props { | { __typename: "anotherHoverlayName" }; } -export default function ThumbnailPreview(props: Immutable): JSX.Element { +export default function PreviewCard(props: Immutable): JSX.Element { const { href, thumbnail, @@ -160,9 +160,8 @@ export default function ThumbnailPreview(props: Immutable): JSX.Element { )}
diff --git a/src/components/ThumbnailHeader.tsx b/src/components/ThumbnailHeader.tsx index 61db87a..e6593e6 100644 --- a/src/components/ThumbnailHeader.tsx +++ b/src/components/ThumbnailHeader.tsx @@ -54,7 +54,6 @@ export default function ThumbnailHeader(props: Immutable): JSX.Element { className=" rounded-xl" image={thumbnail} quality={ImageQuality.Medium} - priority /> ) : (
diff --git a/src/pages/archives/videos/c/[uid].tsx b/src/pages/archives/videos/c/[uid].tsx index a37afea..02ed0e8 100644 --- a/src/pages/archives/videos/c/[uid].tsx +++ b/src/pages/archives/videos/c/[uid].tsx @@ -8,7 +8,7 @@ import ContentPanel, { ContentPanelWidthSizes, } from "components/Panels/ContentPanel"; import SubPanel from "components/Panels/SubPanel"; -import ThumbnailPreview from "components/PreviewCard"; +import PreviewCard from "components/PreviewCard"; import { GetVideoChannelQuery } from "graphql/generated"; import { AppStaticProps, getAppStaticProps } from "graphql/getAppStaticProps"; import { getReadySdk } from "graphql/sdk"; @@ -68,7 +68,7 @@ export default function Channel(props: Props): JSX.Element { {channel?.videos?.data.map((video) => ( <> {video.attributes && ( - ( <> {video.attributes && ( - ): JSX.Element { {items.map((item) => ( <> {item.attributes && ( - ): JSX.Element { ) : (
@@ -270,15 +268,10 @@ export default function LibrarySlug(props: Immutable): JSX.Element { } }} > -
)} @@ -445,7 +438,7 @@ export default function LibrarySlug(props: Immutable): JSX.Element { {item.subitems.data.map((subitem) => ( <> {subitem.attributes && ( - ): JSX.Element { {posts.map((post) => ( <> {post.attributes && ( -