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, {
|
||||
slug: params.slug,
|
||||
});
|
||||
|
||||
const news = (data?.news ?? {}) as NewsFragment;
|
||||
const featuredImage: any = news.featuredImage
|
||||
|
||||
console.log(data)
|
||||
console.log('error', error)
|
||||
const featuredImage: any = news.featuredImage;
|
||||
|
||||
return (
|
||||
<main className="site-main" id="main">
|
||||
<section className="page-header">
|
||||
<h1>{news.title}</h1>
|
||||
{featuredImage && (
|
||||
<Image
|
||||
src={featuredImage.url}
|
||||
alt={featuredImage.alt}
|
||||
width={featuredImage.width}
|
||||
height={featuredImage.height}
|
||||
sizes="100vw"
|
||||
/>
|
||||
<figure key={featuredImage.id}>
|
||||
<Image
|
||||
src={featuredImage.url}
|
||||
alt={featuredImage.alt ?? ""}
|
||||
width={featuredImage.width}
|
||||
height={featuredImage.height}
|
||||
sizes="100vw"
|
||||
/>
|
||||
<figcaption>Bildetekst her?</figcaption>
|
||||
{featuredImage.attribution && (
|
||||
<figcaption>{featuredImage.attribution}</figcaption>
|
||||
)}
|
||||
</figure>
|
||||
)}
|
||||
</section>
|
||||
<section className="page-content">
|
||||
|
Reference in New Issue
Block a user