add news article featured image to figure
This commit is contained in:
@ -35,29 +35,31 @@ export default async function Page({ params }: { params: { slug: string } }) {
|
|||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
|
||||||
const { data, error } = await getClient().query(newsBySlugQuery, {
|
const { data, error } = await getClient().query(newsBySlugQuery, {
|
||||||
slug: params.slug,
|
slug: params.slug,
|
||||||
});
|
});
|
||||||
|
|
||||||
const news = (data?.news ?? {}) as NewsFragment;
|
const news = (data?.news ?? {}) as NewsFragment;
|
||||||
const featuredImage: any = news.featuredImage
|
const featuredImage: any = news.featuredImage;
|
||||||
|
|
||||||
console.log(data)
|
|
||||||
console.log('error', error)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="site-main" id="main">
|
<main className="site-main" id="main">
|
||||||
<section className="page-header">
|
<section className="page-header">
|
||||||
<h1>{news.title}</h1>
|
<h1>{news.title}</h1>
|
||||||
{featuredImage && (
|
{featuredImage && (
|
||||||
<Image
|
<figure key={featuredImage.id}>
|
||||||
src={featuredImage.url}
|
<Image
|
||||||
alt={featuredImage.alt}
|
src={featuredImage.url}
|
||||||
width={featuredImage.width}
|
alt={featuredImage.alt ?? ""}
|
||||||
height={featuredImage.height}
|
width={featuredImage.width}
|
||||||
sizes="100vw"
|
height={featuredImage.height}
|
||||||
/>
|
sizes="100vw"
|
||||||
|
/>
|
||||||
|
<figcaption>Bildetekst her?</figcaption>
|
||||||
|
{featuredImage.attribution && (
|
||||||
|
<figcaption>{featuredImage.attribution}</figcaption>
|
||||||
|
)}
|
||||||
|
</figure>
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
<section className="page-content">
|
<section className="page-content">
|
||||||
|
Reference in New Issue
Block a user