feature: use cdn

This commit is contained in:
Benno Tielen 2024-12-11 14:10:59 +01:00
parent ab8f5028b0
commit a5366a19ee
4 changed files with 25 additions and 11 deletions

View file

@ -14,6 +14,7 @@ import { Col } from '@/components/Flex/Col'
import { Row } from '@/components/Flex/Row' import { Row } from '@/components/Flex/Row'
import { RawHTML } from '@/components/RawHTML/RawHTML' import { RawHTML } from '@/components/RawHTML/RawHTML'
import { Blocks } from '@/compositions/Blocks/Blocks' import { Blocks } from '@/compositions/Blocks/Blocks'
import { getPhoto } from '@/utils/dto/gallery'
export default async function GroupPage({ params }: { params: Promise<{slug: string}>}) { export default async function GroupPage({ params }: { params: Promise<{slug: string}>}) {
@ -25,18 +26,14 @@ export default async function GroupPage({ params }: { params: Promise<{slug: str
} }
const {id, shortDescription, photo,name, text_html, content } = groups.docs[0] const {id, shortDescription, photo,name, text_html, content } = groups.docs[0]
const media = { const media = getPhoto("tablet", photo)
src: typeof photo === "object" && photo ? photo.url || "" : "",
width: typeof photo === "object" && photo ? photo.width || 0 : 0,
height: typeof photo === "object" && photo ? photo.height || 0 : 0
}
const events = await fetchEvents(undefined, id) const events = await fetchEvents(undefined, id)
return ( return (
<> <>
{typeof photo === "object" && { media &&
<ImageWithText <ImageWithText
title={name} title={name}
backgroundColor={"soft"} backgroundColor={"soft"}

View file

@ -72,6 +72,7 @@ export const CollapsibleImageWithText = ({backgroundColor, title, image, text, s
text={text} text={text}
schema={schema} schema={schema}
backgroundColor={backgroundColor} backgroundColor={backgroundColor}
unoptimized={false}
link={<MoreInformation isCollapsed={isCollapsed} onClick={() => setIsCollapsed(!isCollapsed)} />} link={<MoreInformation isCollapsed={isCollapsed} onClick={() => setIsCollapsed(!isCollapsed)} />}
/> />

View file

@ -13,21 +13,36 @@ type ImageWithTextProps = {
image: StaticImageData | string, image: StaticImageData | string,
text: string text: string
link?: React.ReactNode link?: React.ReactNode
schema?: 'base' | 'contrast' schema?: 'base' | 'contrast',
unoptimized?: boolean
} }
export const ImageWithText = ({backgroundColor, title, image, text, link, schema = "base"}: ImageWithTextProps) => { export const ImageWithText = ({backgroundColor, title, image, text, link, schema = "base", unoptimized=true}: ImageWithTextProps) => {
return ( return (
<Section backgroundColor={backgroundColor}> <Section backgroundColor={backgroundColor}>
<Container> <Container>
<Row alignItems={"center"}> <Row alignItems={"center"}>
<div className={classNames(styles.col, styles.imageCol)}> <div className={classNames(styles.col, styles.imageCol)}>
<Image className={styles.image} width={800} height={800} src={image} objectFit={"cover"} alt={""} /> <Image
className={styles.image}
width={800}
height={800}
src={image}
objectFit={"cover"}
unoptimized={unoptimized}
alt={""} />
</div> </div>
<div className={styles.col}> <div className={styles.col}>
<Title title={title} size={"lg"} color={schema} /> <Title title={title} size={"lg"} color={schema} />
<Image className={styles.imageMobile} width={500} height={500} src={image} objectFit={"cover"} alt={""} /> <Image
className={styles.imageMobile}
width={500}
height={500}
src={image}
objectFit={"cover"}
unoptimized={unoptimized}
alt={""} />
<TextDiv text={text} /> <TextDiv text={text} />

View file

@ -33,7 +33,8 @@
object-fit: cover; object-fit: cover;
height: 200px; height: 200px;
width: 510px; width: 510px;
border-radius: $border-radius border-radius: $border-radius;
opacity: 0.9;
} }
@media screen and (max-width: 576px) { @media screen and (max-width: 576px) {