gcg-website/static/admin/previews/page-previews/contest-preview.js

52 lines
1.3 KiB
JavaScript
Raw Normal View History

import {
Container,
ContentJustify,
PageHeader,
Section,
} from "./components/index.js";
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-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"
? h("img", { className: "img-fluid w-100 mb-4", src: imageUrl })
2023-05-29 16:22:34 +02:00
: null,
h(
"div",
{ className: "d-flex justify-content-between mb-4" },
2023-05-29 16:22:34 +02:00
h(
"div",
{ 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",
{ 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
? h("a", { className: "btn btn-primary" }, "Website")
: null
2023-05-29 16:22:34 +02:00
),
h("hr"),
ContentJustify(widgetFor("body")),
2023-05-29 16:22:34 +02:00
])
),
];
};
export default ContestPreview;