website/src/components/article.lisp

38 lines
1.1 KiB
Common Lisp
Raw Normal View History

2025-05-18 18:27:58 +09:00
(defpackage #:website/components/article
(:use #:cl
#:hsx)
(:import-from #:website/lib/time
#:datetime
2025-05-18 23:34:03 +09:00
#:asctime)
2025-05-18 18:27:58 +09:00
(:export #:~article))
(in-package #:website/components/article)
2025-05-25 14:53:40 +09:00
(defcomp ~article (&key title
content
published-at
revised-at
draft-p)
2025-05-18 18:27:58 +09:00
(hsx
(<>
2025-05-18 23:34:03 +09:00
(and draft-p (hsx (p :class "text-lg text-pink-500" "Draft Mode")))
2025-05-18 18:27:58 +09:00
(article :class "prose max-w-none"
(h1 title)
(raw! content)
(p :class "text-right"
2025-05-25 14:53:40 +09:00
(and published-at
(hsx
(span
"(Published: "
(|time| :datetime (datetime published-at)
(asctime published-at))
")")))
(and revised-at
(hsx
(<>
(br)
(span
"(Last updated: "
(|time| :datetime (datetime revised-at)
(asctime revised-at))
")")))))))))