2023-07-31 20:54:52 +02:00
|
|
|
import { Container, PageHeader, Section, Row } from "./components/index.js";
|
2023-04-19 22:44:06 +02:00
|
|
|
|
|
|
|
const ChronikIndexPreview = ({
|
2023-05-29 16:22:34 +02:00
|
|
|
widgetFor,
|
|
|
|
widgetsFor,
|
|
|
|
entry,
|
|
|
|
fields,
|
|
|
|
collection,
|
2023-04-19 22:44:06 +02:00
|
|
|
}) => {
|
2023-05-29 16:22:34 +02:00
|
|
|
const imageField = useMemo(
|
|
|
|
() => 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(
|
|
|
|
widgetsFor("infocard").data.image,
|
|
|
|
collection,
|
|
|
|
imageField,
|
|
|
|
entry
|
|
|
|
);
|
|
|
|
return [
|
|
|
|
PageHeader(entry),
|
2023-07-31 20:54:52 +02:00
|
|
|
Section(
|
|
|
|
Container(widgetFor("body")),
|
2023-05-29 16:22:34 +02:00
|
|
|
widgetsFor("infocard").data.enable
|
2023-07-31 20:54:52 +02:00
|
|
|
? Container(
|
2023-05-29 16:22:34 +02:00
|
|
|
h(
|
|
|
|
"div",
|
|
|
|
{ className: "card mb-3" },
|
|
|
|
h(
|
|
|
|
"div",
|
|
|
|
{ className: "row g-0" },
|
|
|
|
h(
|
|
|
|
"div",
|
|
|
|
{ className: "col-md-3" },
|
|
|
|
h("img", {
|
|
|
|
className: "img-fluid rounded w-100",
|
|
|
|
src: imageUrl,
|
|
|
|
})
|
|
|
|
),
|
|
|
|
h(
|
|
|
|
"div",
|
|
|
|
{ className: "col-md-9 d-flex align-items-center" },
|
|
|
|
h(
|
|
|
|
"div",
|
|
|
|
{ className: "card-body" },
|
|
|
|
h(
|
|
|
|
"p",
|
|
|
|
{ className: "h2 card-title" },
|
|
|
|
widgetsFor("infocard").data.quote
|
|
|
|
),
|
|
|
|
h(
|
|
|
|
"p",
|
|
|
|
{ className: "card-text" },
|
|
|
|
h(
|
|
|
|
"small",
|
|
|
|
{ className: "text-muted" },
|
|
|
|
widgetsFor("infocard").data.author
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: null,
|
2023-07-31 20:54:52 +02:00
|
|
|
Container([
|
2023-06-11 21:13:11 +02:00
|
|
|
h("h2", { className: "mb-4" }, "Informationsseiten"),
|
2023-07-31 20:54:52 +02:00
|
|
|
Row(
|
2023-05-29 16:22:34 +02:00
|
|
|
widgetsFor("links").map((element) =>
|
|
|
|
h(
|
|
|
|
"div",
|
2023-07-31 20:54:52 +02:00
|
|
|
{ className: "col-lg-4 col-sm-6 d-flex align-items-stretch" },
|
2023-05-29 16:22:34 +02:00
|
|
|
h(
|
|
|
|
"div",
|
|
|
|
{
|
2023-07-31 20:54:52 +02:00
|
|
|
className:
|
|
|
|
"card border-primary rounded-0 hover-shadow mb-2 w-100",
|
2023-05-29 16:22:34 +02:00
|
|
|
},
|
|
|
|
h(
|
|
|
|
"div",
|
2023-07-31 20:54:52 +02:00
|
|
|
{ className: "card-body d-flex flex-column" },
|
2023-05-29 16:22:34 +02:00
|
|
|
h(
|
|
|
|
"h4",
|
2023-07-31 20:54:52 +02:00
|
|
|
{ className: "card-title text-truncate mt-auto" },
|
2023-05-29 16:22:34 +02:00
|
|
|
h("a", { href: element.data.link }, element.data.title)
|
|
|
|
),
|
|
|
|
h(
|
|
|
|
"a",
|
|
|
|
{
|
2023-07-31 20:54:52 +02:00
|
|
|
className: "btn btn-primary btn-sm align-self-start",
|
2023-05-29 16:22:34 +02:00
|
|
|
href: element.data.link,
|
|
|
|
},
|
|
|
|
"Mehr anzeigen"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2023-07-31 20:54:52 +02:00
|
|
|
),
|
|
|
|
])
|
2023-05-29 16:22:34 +02:00
|
|
|
),
|
|
|
|
];
|
2023-04-19 22:44:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default ChronikIndexPreview;
|