Add labels to posts

This commit is contained in:
Christoph Hagen
2025-01-26 20:32:44 +01:00
parent 06b4c1ed76
commit 42fa08b43d
15 changed files with 273 additions and 30 deletions

View File

@ -1,12 +1,5 @@
struct ContentLabel {
let icon: PageIcon
let value: String
}
struct ContentLabels {
struct ContentLabels: HtmlProducer {
private let labels: [ContentLabel]
@ -14,15 +7,14 @@ struct ContentLabels {
self.labels = labels
}
var content: String {
func populate(_ result: inout String) {
guard !labels.isEmpty else {
return ""
return
}
var result = "<div class='labels-container'>"
result += "<div class='labels-container'>"
for label in labels {
result += "<div><svg><use href='#\(label.icon.icon.name)'></use></svg>\(label.value)</div>"
}
result += "</div>"
return result
}
}