Merge pull request #14 from Accords-Library/develop
Fixed bug with thumbnail
This commit is contained in:
commit
cd12fba4c6
|
@ -14,7 +14,7 @@ export type ThumbnailHeaderProps = {
|
||||||
description?: string;
|
description?: string;
|
||||||
type?: GetContentQuery["contents"]["data"][number]["attributes"]["type"];
|
type?: GetContentQuery["contents"]["data"][number]["attributes"]["type"];
|
||||||
categories?: GetContentQuery["contents"]["data"][number]["attributes"]["categories"];
|
categories?: GetContentQuery["contents"]["data"][number]["attributes"]["categories"];
|
||||||
thumbnail?: GetContentQuery["contents"]["data"][number]["attributes"]["thumbnail"];
|
thumbnail?: GetContentQuery["contents"]["data"][number]["attributes"]["thumbnail"]["data"]["attributes"];
|
||||||
langui: GetWebsiteInterfaceQuery["websiteInterfaces"]["data"][number]["attributes"];
|
langui: GetWebsiteInterfaceQuery["websiteInterfaces"]["data"][number]["attributes"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,10 +36,10 @@ export default function ThumbnailHeader(
|
||||||
<>
|
<>
|
||||||
<div className="grid place-items-center gap-12 mb-12">
|
<div className="grid place-items-center gap-12 mb-12">
|
||||||
<div className="drop-shadow-shade-lg">
|
<div className="drop-shadow-shade-lg">
|
||||||
{thumbnail && thumbnail.data ? (
|
{thumbnail ? (
|
||||||
<Img
|
<Img
|
||||||
className=" rounded-xl"
|
className=" rounded-xl"
|
||||||
image={thumbnail.data.attributes}
|
image={thumbnail}
|
||||||
quality={ImageQuality.Medium}
|
quality={ImageQuality.Medium}
|
||||||
priority
|
priority
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default function ContentIndex(props: ContentIndexProps): JSX.Element {
|
||||||
/>
|
/>
|
||||||
<div className="grid place-items-center">
|
<div className="grid place-items-center">
|
||||||
<ThumbnailHeader
|
<ThumbnailHeader
|
||||||
thumbnail={content.thumbnail}
|
thumbnail={content.thumbnail.data?.attributes}
|
||||||
pre_title={
|
pre_title={
|
||||||
content.titles.length > 0 ? content.titles[0].pre_title : undefined
|
content.titles.length > 0 ? content.titles[0].pre_title : undefined
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ export default function ContentRead(props: ContentReadProps): JSX.Element {
|
||||||
/>
|
/>
|
||||||
<div className="grid place-items-center">
|
<div className="grid place-items-center">
|
||||||
<ThumbnailHeader
|
<ThumbnailHeader
|
||||||
thumbnail={content.thumbnail}
|
thumbnail={content.thumbnail.data?.attributes}
|
||||||
pre_title={
|
pre_title={
|
||||||
content.titles.length > 0 ? content.titles[0].pre_title : undefined
|
content.titles.length > 0 ? content.titles[0].pre_title : undefined
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import SubPanel from "components/Panels/SubPanel";
|
||||||
import RecorderChip from "components/RecorderChip";
|
import RecorderChip from "components/RecorderChip";
|
||||||
import ToolTip from "components/ToolTip";
|
import ToolTip from "components/ToolTip";
|
||||||
import { getPost, getPostsSlugs } from "graphql/operations";
|
import { getPost, getPostsSlugs } from "graphql/operations";
|
||||||
import { GetPostQuery } from "graphql/operations-types";
|
import { GetPostQuery, StrapiImage } from "graphql/operations-types";
|
||||||
import { GetStaticPaths, GetStaticProps } from "next";
|
import { GetStaticPaths, GetStaticProps } from "next";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
|
||||||
|
@ -27,6 +27,13 @@ export default function LibrarySlug(props: PostProps): JSX.Element {
|
||||||
const { post, postId, langui } = props;
|
const { post, postId, langui } = props;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
const thumbnail: StrapiImage | undefined =
|
||||||
|
post.translations.length > 0 && post.translations[0].thumbnail.data
|
||||||
|
? post.translations[0].thumbnail.data.attributes
|
||||||
|
: post.thumbnail.data
|
||||||
|
? post.thumbnail.data.attributes
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const subPanel = (
|
const subPanel = (
|
||||||
<SubPanel>
|
<SubPanel>
|
||||||
<ReturnButton
|
<ReturnButton
|
||||||
|
@ -83,11 +90,7 @@ export default function LibrarySlug(props: PostProps): JSX.Element {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ThumbnailHeader
|
<ThumbnailHeader
|
||||||
thumbnail={
|
thumbnail={thumbnail}
|
||||||
post.translations.length > 0 && post.translations[0].thumbnail.data
|
|
||||||
? post.translations[0].thumbnail
|
|
||||||
: post.thumbnail
|
|
||||||
}
|
|
||||||
title={
|
title={
|
||||||
post.translations.length > 0
|
post.translations.length > 0
|
||||||
? post.translations[0].title
|
? post.translations[0].title
|
||||||
|
@ -120,7 +123,7 @@ export default function LibrarySlug(props: PostProps): JSX.Element {
|
||||||
}
|
}
|
||||||
contentPanel={contentPanel}
|
contentPanel={contentPanel}
|
||||||
subPanel={subPanel}
|
subPanel={subPanel}
|
||||||
thumbnail={post.translations[0].thumbnail.data?.attributes}
|
thumbnail={thumbnail}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue