2023-07-31 20:54:52 +02:00
|
|
|
import {
|
|
|
|
Container,
|
|
|
|
ContentJustify,
|
|
|
|
PageHeader,
|
|
|
|
Section,
|
|
|
|
} from "./components/index.js";
|
2023-04-19 22:44:06 +02:00
|
|
|
|
|
|
|
const ContestPreview = ({ widgetFor, entry, fields, collection }) => {
|
2023-05-29 16:22:34 +02:00
|
|
|
const imageField = useMemo(() => {
|
|
|
|
return fields.find((field) => field.name === "image");
|
|
|
|
}, [fields]);
|
2023-04-19 22:44:06 +02:00
|
|
|
|
2023-05-29 16:22:34 +02:00
|
|
|
const imageUrl = useMediaAsset(
|
|
|
|
entry.data.image,
|
|
|
|
collection,
|
|
|
|
imageField,
|
|
|
|
entry
|
|
|
|
);
|
|
|
|
return [
|
|
|
|
PageHeader(entry),
|
|
|
|
Section(
|
|
|
|
Container([
|
|
|
|
entry.data.image && entry.data.image != "/media/image.webp"
|
2023-07-31 20:54:52 +02:00
|
|
|
? h("img", { className: "img-fluid w-100 mb-4", src: imageUrl })
|
2023-05-29 16:22:34 +02:00
|
|
|
: null,
|
|
|
|
h(
|
|
|
|
"div",
|
2023-07-31 20:54:52 +02:00
|
|
|
{ className: "d-flex justify-content-between mb-4" },
|
2023-05-29 16:22:34 +02:00
|
|
|
h(
|
|
|
|
"div",
|
2023-07-31 20:54:52 +02:00
|
|
|
{ className: "d-flex align-items-center" },
|
|
|
|
h("i", { className: "mdi mdi-crowd text-primary icon-md me-2" }),
|
2023-05-29 16:22:34 +02:00
|
|
|
h(
|
|
|
|
"div",
|
2023-07-31 20:54:52 +02:00
|
|
|
{ className: "text-start" },
|
|
|
|
h("h6", { className: "mb-0 text-uppercase" }, "Klassen"),
|
|
|
|
h("p", { className: "mb-0" }, entry.data.class)
|
2023-05-29 16:22:34 +02:00
|
|
|
)
|
|
|
|
),
|
|
|
|
entry.data.web_url
|
2023-07-31 20:54:52 +02:00
|
|
|
? h("a", { className: "btn btn-primary" }, "Website")
|
|
|
|
: null
|
2023-05-29 16:22:34 +02:00
|
|
|
),
|
2023-07-31 20:54:52 +02:00
|
|
|
h("hr"),
|
|
|
|
ContentJustify(widgetFor("body")),
|
2023-05-29 16:22:34 +02:00
|
|
|
])
|
|
|
|
),
|
|
|
|
];
|
2023-04-19 22:44:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default ContestPreview;
|