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

65 lines
1.6 KiB
JavaScript
Raw Normal View History

import { PageHeader } from "./components/index.js";
const AboutPreview = ({ widgetFor, widgetsFor, entry, fields, collection }) => {
2023-05-29 16:22:34 +02:00
const imageField = useMemo(
() => 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),
h(
"section",
2023-06-11 21:13:11 +02:00
{ className: "section" },
2023-05-29 16:22:34 +02:00
h(
"div",
{ className: "container" },
h(
"div",
{ className: "row" },
h(
"div",
{ className: "col-12" },
h("img", { className: "img-fluid w-100 mb-4", src: imageUrl }),
widgetFor("body")
)
)
)
),
entry.data.stats.enable
? h(
"section",
2023-06-11 21:13:11 +02:00
{ className: "section bg-primary" },
2023-05-29 16:22:34 +02:00
h(
"div",
{ className: "container" },
h(
"div",
{ className: "row" },
widgetsFor("stats").data.zahlen.map((element) => {
return h(
"div",
{ className: "col-md-4 col-sm-6 mb-4 mb-md-0" },
h(
"div",
{ className: "text-center" },
h("h2", { className: "count text-white" }, element.count),
h("h5", { className: "text-white" }, element.name)
)
);
})
)
)
)
: null,
];
};
export default AboutPreview;