use-package piccolo
This commit is contained in:
parent
d614f039d3
commit
430c1ee5a8
4 changed files with 53 additions and 53 deletions
src
|
@ -1,6 +1,6 @@
|
|||
(defpackage #:hp/components/document
|
||||
(:use #:cl)
|
||||
(:local-nicknames (#:pi #:piccolo))
|
||||
(:use #:cl
|
||||
#:piccolo)
|
||||
(:import-from #:hp/view/asset
|
||||
#:defasset)
|
||||
(:export #:document))
|
||||
|
@ -20,24 +20,23 @@
|
|||
(defasset *global-css* :root "global.css")
|
||||
(defasset *dist-css* :root "dist.css")
|
||||
|
||||
(pi:define-element document (title description)
|
||||
(pi:h
|
||||
(html :lang "ja"
|
||||
(head
|
||||
(meta :charset "UTF-8")
|
||||
(script :src *htmx*)
|
||||
(mapcar (lambda (path) (script :src path))
|
||||
*htmx-exts*)
|
||||
(mapcar (lambda (path) (script :src path :defer t))
|
||||
*alpine-exts*)
|
||||
(script :src *alpine-store* :defer t)
|
||||
(script :src *alpine* :defer t)
|
||||
(style
|
||||
"@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');")
|
||||
(link :rel "stylesheet" :type "text/css" :href *global-css*)
|
||||
(link :rel "stylesheet" :type "text/css" :href *dist-css*)
|
||||
(title (format nil "~@[~a - ~]skyizwhite.dev" title))
|
||||
(meta
|
||||
:name "description"
|
||||
:content (or description "pakuの個人サイト")))
|
||||
pi:children)))
|
||||
(define-element document (title description)
|
||||
(html :lang "ja"
|
||||
(head
|
||||
(meta :charset "UTF-8")
|
||||
(script :src *htmx*)
|
||||
(mapcar (lambda (path) (script :src path))
|
||||
*htmx-exts*)
|
||||
(mapcar (lambda (path) (script :src path :defer t))
|
||||
*alpine-exts*)
|
||||
(script :src *alpine-store* :defer t)
|
||||
(script :src *alpine* :defer t)
|
||||
(style
|
||||
"@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');")
|
||||
(link :rel "stylesheet" :type "text/css" :href *global-css*)
|
||||
(link :rel "stylesheet" :type "text/css" :href *dist-css*)
|
||||
(title (format nil "~@[~a - ~]skyizwhite.dev" title))
|
||||
(meta
|
||||
:name "description"
|
||||
:content (or description "pakuの個人サイト")))
|
||||
children))
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
(defpackage #:hp/components/layout
|
||||
(:use #:cl)
|
||||
(:local-nicknames (#:pi #:piccolo))
|
||||
(:use #:cl
|
||||
#:piccolo)
|
||||
(:local-nicknames (#:cfg #:hp/config/*))
|
||||
(:export #:layout))
|
||||
(in-package #:hp/components/layout)
|
||||
|
||||
(pi:define-element layout ()
|
||||
(pi:h
|
||||
(body
|
||||
:hx-ext cfg:*hx-ext*
|
||||
:class "h-[100svh] flex flex-col"
|
||||
(header)
|
||||
(main :class "flex-1"
|
||||
pi:children)
|
||||
; footer
|
||||
(footer))))
|
||||
(define-element layout ()
|
||||
(body
|
||||
:hx-ext cfg:*hx-ext*
|
||||
:class "h-[100svh] flex flex-col"
|
||||
(header)
|
||||
(main :class "flex-1"
|
||||
children)
|
||||
; footer
|
||||
(footer)))
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
(defpackage #:hp/routes/index
|
||||
(:use #:cl)
|
||||
(:local-nicknames (#:pi #:piccolo))
|
||||
(:use #:cl
|
||||
#:piccolo)
|
||||
(:local-nicknames (#:view #:hp/view/*))
|
||||
(:export #:handle-get))
|
||||
(in-package #:hp/routes/index)
|
||||
|
||||
(pi:define-element page ()
|
||||
(pi:h
|
||||
(div :class "h-full place-content-center"
|
||||
(h1
|
||||
:x-data "{flag: true}"
|
||||
:@click "flag = ! flag"
|
||||
:class "text-4xl text-center"
|
||||
:|:class| "flag ? 'text-red-400' : 'text-blue-400'"
|
||||
"Hello, world!"))))
|
||||
(define-element page ()
|
||||
(div :class "h-full place-content-center"
|
||||
(h1
|
||||
:x-data "{
|
||||
flag: true,
|
||||
toggle() {
|
||||
this.flag = !this.flag
|
||||
}
|
||||
}"
|
||||
:@click "toggle"
|
||||
:class "text-4xl text-center"
|
||||
:|:class| "flag ? 'text-red-400' : 'text-blue-400'"
|
||||
"Hello, world!")))
|
||||
|
||||
(defun handle-get (params)
|
||||
(declare (ignore params))
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
(defpackage #:hp/routes/not-found
|
||||
(:use #:cl)
|
||||
(:local-nicknames (#:jg #:jingle))
|
||||
(:local-nicknames (#:pi #:piccolo))
|
||||
(:use #:cl
|
||||
#:piccolo)
|
||||
(:local-nicknames (#:view #:hp/view/*))
|
||||
(:export #:handle-not-found))
|
||||
(in-package #:hp/routes/not-found)
|
||||
|
@ -10,10 +9,9 @@
|
|||
'(:title "404 Not Found"
|
||||
:description "お探しのページは見つかりませんでした。"))
|
||||
|
||||
(pi:define-element page ()
|
||||
(pi:h
|
||||
(section
|
||||
(h1 "404 Not Found"))))
|
||||
(define-element page ()
|
||||
(section
|
||||
(h1 "404 Not Found")))
|
||||
|
||||
(defun handle-not-found ()
|
||||
(view:render (page)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue