Add ~article component
This commit is contained in:
parent
631d979faf
commit
c90c89a74f
3 changed files with 36 additions and 31 deletions
src
21
src/components/article.lisp
Normal file
21
src/components/article.lisp
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
(defpackage #:website/components/article
|
||||||
|
(:use #:cl
|
||||||
|
#:hsx)
|
||||||
|
(:import-from #:website/lib/time
|
||||||
|
#:datetime
|
||||||
|
#:jp-datetime)
|
||||||
|
(:export #:~article))
|
||||||
|
(in-package #:website/components/article)
|
||||||
|
|
||||||
|
(defcomp ~article (&key title content revised-at draft-p)
|
||||||
|
(hsx
|
||||||
|
(<>
|
||||||
|
(and draft-p (hsx (p :class "text-lg text-pink-500" "下書きモード")))
|
||||||
|
(article :class "prose max-w-none"
|
||||||
|
(h1 title)
|
||||||
|
(raw! content)
|
||||||
|
(p :class "text-right"
|
||||||
|
"(最終更新:"
|
||||||
|
(|time| :datetime (datetime revised-at)
|
||||||
|
(jp-datetime revised-at))
|
||||||
|
")")))))
|
|
@ -1,13 +1,11 @@
|
||||||
(defpackage #:website/routes/about
|
(defpackage #:website/routes/about
|
||||||
(:use #:cl
|
(:use #:cl
|
||||||
#:hsx
|
#:hsx
|
||||||
#:jingle
|
#:jingle)
|
||||||
#:access)
|
|
||||||
(:import-from #:website/lib/cms
|
(:import-from #:website/lib/cms
|
||||||
#:get-about)
|
#:get-about)
|
||||||
(:import-from #:website/lib/time
|
(:import-from #:website/components/article
|
||||||
#:datetime
|
#:~article)
|
||||||
#:jp-datetime)
|
|
||||||
(:export #:handle-get))
|
(:export #:handle-get))
|
||||||
(in-package #:website/routes/about)
|
(in-package #:website/routes/about)
|
||||||
|
|
||||||
|
@ -19,14 +17,8 @@
|
||||||
(with-request-params ((draft-key "draft-key" nil)) params
|
(with-request-params ((draft-key "draft-key" nil)) params
|
||||||
(setf (context :no-cache) draft-key)
|
(setf (context :no-cache) draft-key)
|
||||||
(let ((about (get-about :query (list :draft-key draft-key))))
|
(let ((about (get-about :query (list :draft-key draft-key))))
|
||||||
(hsx
|
(~article
|
||||||
(<>
|
:title "About"
|
||||||
(and draft-key (hsx (p :class "text-lg text-pink-500" "下書きモード")))
|
:content (getf about :content)
|
||||||
(article :class "prose max-w-none"
|
:revised-at (getf about :revised-at)
|
||||||
(h1 "About")
|
:draft-p draft-key))))
|
||||||
(raw! (getf about :content))
|
|
||||||
(p :class "text-right"
|
|
||||||
"(最終更新:"
|
|
||||||
(|time| :datetime (datetime (getf about :revised-at))
|
|
||||||
(jp-datetime (getf about :revised-at)))
|
|
||||||
")")))))))
|
|
||||||
|
|
|
@ -4,10 +4,8 @@
|
||||||
#:jingle)
|
#:jingle)
|
||||||
(:import-from #:website/lib/cms
|
(:import-from #:website/lib/cms
|
||||||
#:get-works)
|
#:get-works)
|
||||||
(:import-from #:website/lib/time
|
(:import-from #:website/components/article
|
||||||
#:datetime
|
#:~article))
|
||||||
#:jp-datetime)
|
|
||||||
(:export #:handle-get))
|
|
||||||
(in-package #:website/routes/works)
|
(in-package #:website/routes/works)
|
||||||
|
|
||||||
(defparameter *metadata*
|
(defparameter *metadata*
|
||||||
|
@ -18,14 +16,8 @@
|
||||||
(with-request-params ((draft-key "draft-key" nil)) params
|
(with-request-params ((draft-key "draft-key" nil)) params
|
||||||
(setf (context :no-cache) draft-key)
|
(setf (context :no-cache) draft-key)
|
||||||
(let ((works (get-works :query (list :draft-key draft-key))))
|
(let ((works (get-works :query (list :draft-key draft-key))))
|
||||||
(hsx
|
(~article
|
||||||
(<>
|
:title "Works"
|
||||||
(and draft-key (hsx (p :class "text-lg text-pink-500" "下書きモード")))
|
:content (getf works :content)
|
||||||
(article :class "prose max-w-none"
|
:revised-at (getf works :revised-at)
|
||||||
(h1 "Works")
|
:draft-p draft-key))))
|
||||||
(raw! (getf works :content))
|
|
||||||
(p :class "text-right"
|
|
||||||
"(最終更新:"
|
|
||||||
(|time| :datetime (datetime (getf works :revised-at))
|
|
||||||
(jp-datetime (getf works :revised-at)))
|
|
||||||
")")))))))
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue