show some featured images

This commit is contained in:
2024-05-10 16:20:19 +02:00
parent db8c88ffba
commit de0af201cc
11 changed files with 73 additions and 12 deletions

View File

@ -1,11 +1,23 @@
import { EventFragment } from "@/gql/graphql";
import styles from "./eventItem.module.scss";
import Link from "next/link";
import Image from "../general/Image";
export const EventItem = ({ event }: { event: EventFragment }) => {
return (
<li className={`${styles.eventItem} linkItem`}>
<div className={styles.image}></div>
<div className={styles.image}>
{event.featuredImage && (
<Image
src={event.featuredImage.url}
alt=""
width={0}
height={0}
sizes="20vw"
// style={{ width: '100%', height: 'auto' }} // optional
/>
)}
</div>
<div className={styles.text}>
<h1 className={styles.title}>{event.title}</h1>
<p className={styles.details}>Detaljer og tidspunkt</p>

View File

@ -5,8 +5,14 @@
.image {
width: 100%;
padding-top: 60%;
height: auto;
// padding-top: 60%;
background: var(--color-neufPink);
img {
width: 100%;
height: auto;
}
}
.text {
@ -20,4 +26,4 @@
.details {
font-family: var(--font-serif);
}
}

View File

@ -0,0 +1,7 @@
import NextImage, { ImageProps as NextImageProps } from "next/image";
type ImageProps = NextImageProps;
export default function Image(props: ImageProps) {
return <NextImage {...props} />;
}