1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-10-16 15:07:27 +00:00
festa/components/postcard/renderer.tsx

24 lines
No EOL
806 B
TypeScript

import { default as classNames } from "classnames"
import style from "./renderer.module.css"
import Image, { ImageProps } from "next/image"
import { useDefinedContext } from "../../utils/definedContext"
import { PostcardContext, PostcardVisibility } from "./base"
export function PostcardRenderer(props: Partial<ImageProps>) {
const { src, visibility } = useDefinedContext(PostcardContext)
return (
<Image
src={src}
layout="raw"
alt=""
{...props}
className={classNames(
style.postcard,
visibility === PostcardVisibility.BACKGROUND ? style.postcardBackground : null,
visibility === PostcardVisibility.FOREGROUND ? style.postcardForeground : null,
)}
/>
)
}