1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 07:04:22 +00:00
festa/components/Postcard.tsx

16 lines
481 B
TypeScript
Raw Normal View History

2022-05-24 16:55:21 +00:00
import { PostcardContext } from "../contexts/postcard";
2022-05-27 00:46:30 +00:00
import { useDefinedContext } from "../utils/definedContext";
2022-05-24 16:55:21 +00:00
export function Postcard() {
const [postcard, _] = useDefinedContext(PostcardContext)
2022-06-03 02:25:26 +00:00
const postcardUrl = typeof postcard === "string" ? postcard : postcard.src
2022-06-02 02:26:52 +00:00
/* eslint-disable @next/next/no-img-element */
2022-06-03 02:25:26 +00:00
return <>
<div
2022-05-24 16:55:21 +00:00
className="postcard"
2022-06-03 02:25:26 +00:00
style={{backgroundImage: `url(${postcardUrl})`}}
2022-05-24 16:55:21 +00:00
/>
2022-06-03 02:25:26 +00:00
</>
2022-05-24 16:55:21 +00:00
}