Update hsx to v0.4.0

This commit is contained in:
Akira Tempaku 2024-12-12 13:21:19 +09:00
parent ba67f59737
commit 2e325fbc06
7 changed files with 27 additions and 24 deletions

View file

@ -17,7 +17,7 @@
("hsx" . ("hsx" .
(:class qlot/source/git:source-git (:class qlot/source/git:source-git
:initargs (:remote-url "https://github.com/skyizwhite/hsx.git") :initargs (:remote-url "https://github.com/skyizwhite/hsx.git")
:version "git-7ce7751900ce6eacb9264b3109402bcc17aa40b2")) :version "git-f60259ec4a101de87c5364c3f1b571706448d3a0"))
("ningle-fbr" . ("ningle-fbr" .
(:class qlot/source/git:source-git (:class qlot/source/git:source-git
:initargs (:remote-url "https://github.com/skyizwhite/ningle-fbr.git") :initargs (:remote-url "https://github.com/skyizwhite/ningle-fbr.git")

View file

@ -1,11 +1,11 @@
(defpackage #:hp/components/footer (defpackage #:hp/components/footer
(:use #:cl (:use #:cl
#:hsx) #:hsx)
(:export #:page-footer)) (:export #:~footer))
(in-package #:hp/components/footer) (in-package #:hp/components/footer)
(defcomp page-footer () (defcomp ~footer ()
(hsx (hsx
(footer :class "fixed bottom-0 w-full" (footer :class "fixed bottom-0 w-full"
(div :class "container py-6 flex justify-end" (div :class "container py-6 flex justify-end"
(p "© 2025 skyizwhite"))))) (p "© 2025 skyizwhite")))))

View file

@ -1,10 +1,10 @@
(defpackage #:hp/components/header (defpackage #:hp/components/header
(:use #:cl (:use #:cl
#:hsx) #:hsx)
(:export #:page-header)) (:export #:~header))
(in-package #:hp/components/header) (in-package #:hp/components/header)
(defcomp page-header () (defcomp ~header ()
(let ((links '(("Home" "/") (let ((links '(("Home" "/")
("About" "/about") ("About" "/about")
("Work" "/work") ("Work" "/work")
@ -20,7 +20,8 @@
:class "w-52 h-auto"))) :class "w-52 h-auto")))
(ul :class "flex flex-col gap-4" (ul :class "flex flex-col gap-4"
(loop (loop
:for (content href) :in links :collect :for (title href) :in links :collect
(li :class "flex items-center" (hsx
(a :href href :class "text-lg hover:text-orange-600" (li :class "flex items-center"
content))))))))) (a :href href :class "text-lg hover:text-orange-600"
title))))))))))

View file

@ -15,8 +15,9 @@
(main (main
(h1 "500 Internal Server Error") (h1 "500 Internal Server Error")
(when (env:dev-mode-p) (when (env:dev-mode-p)
(pre (hsx
(code (tb:print-backtrace condition :output nil))))))))) (pre
(code (tb:print-backtrace condition :output nil))))))))))
(defparameter *recoverer* (defparameter *recoverer*
(lambda (app) (lambda (app)

View file

@ -13,7 +13,7 @@
(defun bust-cache (url) (defun bust-cache (url)
(format nil "~a?~a" url #.(get-universal-time))) (format nil "~a?~a" url #.(get-universal-time)))
(defcomp document (&key title description children) (defcomp ~document (&key title description children)
(hsx (hsx
(html :lang "ja" (html :lang "ja"
(head (head
@ -34,18 +34,19 @@
:name "description" :name "description"
:content :content
(or description (or description
(<> (hsx
"Welcome to the official website of 'Amongtellers (Amaterasu)', " (<>
"a personal project by paku (skyizwhite). " "Welcome to the official website of 'Amongtellers (Amaterasu)', "
"Discover project details, the latest updates, and related activities.")))) "a personal project by paku (skyizwhite). "
"Discover project details, the latest updates, and related activities.")))))
(body (body
:hx-ext "head-support, response-targets" :hx-ext "head-support, response-targets"
:hx-boost "true" :hx-target-404 "body" :hx-target-5* "body" :hx-boost "true" :hx-target-404 "body" :hx-target-5* "body"
:class "h-[100svh] flex flex-col" :class "h-[100svh] flex flex-col"
(cmp:page-header) (cmp:~header)
(main :class "flex-1 h-full" (main :class "flex-1 h-full"
children) children)
(cmp:page-footer))))) (cmp:~footer)))))
(defmethod jg:process-response ((app jg:app) result) (defmethod jg:process-response ((app jg:app) result)
(jg:set-response-header :content-type "text/html; charset=utf-8") (jg:set-response-header :content-type "text/html; charset=utf-8")
@ -59,5 +60,5 @@
((guard (or (list element metadata) ((guard (or (list element metadata)
element) element)
(typep element 'element)) (typep element 'element))
(document metadata element)) (~document metadata element))
(_ (error "Invalid response form")))))) (_ (error "Invalid response form"))))))

View file

@ -4,7 +4,7 @@
(:export #:handle-get)) (:export #:handle-get))
(in-package #:hp/routes/index) (in-package #:hp/routes/index)
(defcomp page () (defcomp ~page ()
(hsx (hsx
(section (section
; first view ; first view
@ -18,4 +18,4 @@
(defun handle-get (params) (defun handle-get (params)
(declare (ignore params)) (declare (ignore params))
(page)) (~page))

View file

@ -9,7 +9,7 @@
'(:title "404 Not Found" '(:title "404 Not Found"
:description "The page you are looking for may have been deleted or the URL might be incorrect.")) :description "The page you are looking for may have been deleted or the URL might be incorrect."))
(defcomp page () (defcomp ~page ()
(hsx (hsx
(section :class "container flex flex-col justify-center items-center h-full gap-10" (section :class "container flex flex-col justify-center items-center h-full gap-10"
(h1 :class "text-2xl text-red-600" (h1 :class "text-2xl text-red-600"
@ -20,4 +20,4 @@
(defun handle-not-found () (defun handle-not-found ()
(jg:set-response-status :not-found) (jg:set-response-status :not-found)
(list (page) *metadata*)) (list (~page) *metadata*))