Files
.gitea
assets
content
data
layouts
static
admin
config
links
previews
field-previews
page-previews
components
abiturienten-preview.js
about-preview.js
anmeldeformular-preview.js
anmeldung-preview.js
author-preview.js
blog-preview.js
cantorpreis-preview.js
chronik-index-preview.js
chronik-preview.js
contest-preview.js
event-preview.js
forms-preview.js
ganztag-preview.js
header-preview.js
index.js
kontakt-preview.js
page-preview.js
projektwoche-preview.js
styles.js
shortcodes
icons.js
index.html
data
media
schulchronik
favicon.ico
.gitignore
.mailmap
LICENSE
config.yml
go.mod
go.sum
gcg-website/static/admin/previews/page-previews/blog-preview.js

73 lines
1.8 KiB
JavaScript

import {
DateFormat,
PageHeader,
Section,
Container,
} from "./components/index.js";
const BlogPreview = ({ widgetFor, entry, fields, collection }) => {
const imageField = useMemo(() => {
return fields.find((field) => field.name === "image");
}, [fields]);
const imageUrl = useMediaAsset(
entry.data.image,
collection,
imageField,
entry
);
return [
PageHeader(entry),
Section(
Container([
h("img", { className: "img-fluid w-100 mb-4", src: imageUrl }),
h(
"div",
{ className: "d-flex flex-wrap gap-2 justify-content-between" },
h(
"div",
{ className: "text-body-secondary" },
h("span", { className: "fw-bold me-1" }, "Geschrieben von:"),
widgetFor("author")
),
h(
"div",
{ className: "text-body-secondary" },
h("span", { className: "fw-bold me-1" }, "Datum:"),
entry.data.date
? DateFormat({
date: entry.data.date,
format: {
day: "numeric",
month: "short",
year: "numeric",
},
})
: ""
),
h(
"div",
{ className: "text-body-secondary" },
h("span", { className: "fw-bold me-1" }, "Kategorien:"),
entry.data.categories
? entry.data.categories.map(
(category, index) => (index != 0 ? ", " : "") + category
)
: ""
)
),
h("div", { className: "border-bottom my-4" }),
h(
"div",
{
className: "content text-justify mb-4",
},
widgetFor("body")
),
])
),
];
};
export default BlogPreview;