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" .
(:class qlot/source/git:source-git
:initargs (:remote-url "https://github.com/skyizwhite/hsx.git")
:version "git-7ce7751900ce6eacb9264b3109402bcc17aa40b2"))
:version "git-f60259ec4a101de87c5364c3f1b571706448d3a0"))
("ningle-fbr" .
(:class qlot/source/git:source-git
:initargs (:remote-url "https://github.com/skyizwhite/ningle-fbr.git")

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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