Implemented phase 1 for the POC prototype in the Website service.

This commit is contained in:
javier committed 2026-09-21 11:16:52 +02:00
1 parent 6d7ab4bcba
commit ea89ea892a
37 files changed
+4173 -43

No files matched your search

@@ -0,0 +1,60 @@
import Elementary
import Persistence
/// A placeholder cover: lettering on a toned ground, scaling with its width. Stands in until listings carry photos.
struct Cover: HTML {
// MARK: Properties
/// The cover's lettering and tone.
let cover: Listing.Cover
/// A modifier class positioning or sizing the cover, or `nil` for none.
let modifier: String?
// MARK: Initializers
/// Creates a placeholder cover.
/// - Parameters:
/// - cover: the cover's lettering and tone.
/// - modifier: a modifier class positioning or sizing the cover, or `nil` (the default) for none.
init(
_ cover: Listing.Cover,
modifier: String? = nil
) {
self.cover = cover
self.modifier = modifier
}
// MARK: Computed
/// Decorative: whatever links to the listing names it.
var body: some HTML {
div(
.class(["cover", "cover--\(cover.tone)", modifier].compactMap(\.self).joined(separator: " ")),
.custom(
name: "aria-hidden",
value: "true"
)
) {
div(.class("cover__face")) {
div(.class("cover__title")) {
for line in cover.title.split(separator: "\n") {
span {
String(line)
}
}
}
div(.class("cover__foot")) {
span(.class("cover__imprint")) {
cover.imprint
}
span(.class(cover.number.allSatisfy(\.isNumber) ? "cover__number" : "cover__number cover__number--text")) {
cover.number
}
}
}
}
}
}