Make page transitions smooth
This commit is contained in:
parent
a8d4c47742
commit
604912cf36
4 changed files with 27 additions and 13 deletions
|
@ -50,12 +50,9 @@
|
||||||
"fixed flex flex-col items-center justify-center "
|
"fixed flex flex-col items-center justify-center "
|
||||||
"z-10 top-0 right-0 w-full h-full gap-16 bg-gray-200")
|
"z-10 top-0 right-0 w-full h-full gap-16 bg-gray-200")
|
||||||
:x-show "open"
|
:x-show "open"
|
||||||
:|x-transition:enter| "transition ease-out duration-400"
|
:x-transition.opacity t
|
||||||
:|x-transition:enter-start| "translate-x-full"
|
:|x-transition:enter.duration.300ms| t
|
||||||
:|x-transition:enter-end| "translate-x-0"
|
:|x-transition:leave.duration.300ms| t
|
||||||
:|x-transition:leave| "transition ease-in duration-400"
|
|
||||||
:|x-transition:leave-start| "translate-x-0"
|
|
||||||
:|x-transition:leave-end| "translate-x-full"
|
|
||||||
(h2 :class "text-5xl font-bold"
|
(h2 :class "text-5xl font-bold"
|
||||||
"Menu")
|
"Menu")
|
||||||
(ul
|
(ul
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
(defcomp ~layout (&key children)
|
(defcomp ~layout (&key children)
|
||||||
(hsx
|
(hsx
|
||||||
(div :class "flex flex-col h-[100svh] w-full max-w-[700px] px-2 mx-auto"
|
(div :class "fade flex flex-col h-[100svh] w-full max-w-[700px] px-2 mx-auto"
|
||||||
(~header)
|
(~header)
|
||||||
(div :class "flex flex-col flex-1 overflow-y-scroll"
|
(div :class "flex flex-col flex-1 overflow-y-scroll"
|
||||||
(main :class "flex-1 px-2 py-6 md:px-4 md:py-8"
|
(main :class "flex-1 px-2 py-6 md:px-4 md:py-8"
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#:jingle)
|
#:jingle)
|
||||||
(:import-from #:hsx/element
|
(:import-from #:hsx/element
|
||||||
#:element)
|
#:element)
|
||||||
(:import-from #:website/lib/env
|
|
||||||
#:website-env)
|
|
||||||
(:import-from #:website/components/metadata
|
(:import-from #:website/components/metadata
|
||||||
#:~metadata)
|
#:~metadata)
|
||||||
(:import-from #:website/components/scripts
|
(:import-from #:website/components/scripts
|
||||||
|
@ -17,9 +15,7 @@
|
||||||
(defmethod jingle:process-response ((app jingle:app) result)
|
(defmethod jingle:process-response ((app jingle:app) result)
|
||||||
(set-response-header :content-type "text/html; charset=utf-8")
|
(set-response-header :content-type "text/html; charset=utf-8")
|
||||||
(when (eq (request-method *request*) :get)
|
(when (eq (request-method *request*) :get)
|
||||||
(set-response-header :cache-control (if (string= (website-env) "dev")
|
(set-response-header :cache-control "public, max-age=60"))
|
||||||
"private, no-store"
|
|
||||||
"public, max-age=60")))
|
|
||||||
(call-next-method app
|
(call-next-method app
|
||||||
(render-to-string
|
(render-to-string
|
||||||
(hsx (html :lang "ja"
|
(hsx (html :lang "ja"
|
||||||
|
@ -28,5 +24,6 @@
|
||||||
(~scripts))
|
(~scripts))
|
||||||
(body
|
(body
|
||||||
:hx-ext "head-support, response-targets, preload"
|
:hx-ext "head-support, response-targets, preload"
|
||||||
:hx-boost "true" :hx-target-404 "body" :hx-target-5* "body"
|
:hx-boost "true" :hx-swap "transition:true"
|
||||||
|
:hx-target-404 "body" :hx-target-5* "body"
|
||||||
(~layout result)))))))
|
(~layout result)))))))
|
||||||
|
|
|
@ -23,3 +23,23 @@
|
||||||
font-family: "Zen Maru Gothic", sans-serif;
|
font-family: "Zen Maru Gothic", sans-serif;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes fade-in {
|
||||||
|
from { opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fade-out {
|
||||||
|
to { opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
::view-transition-old(fade) {
|
||||||
|
animation: 300ms ease both fade-out,
|
||||||
|
}
|
||||||
|
|
||||||
|
::view-transition-new(fade) {
|
||||||
|
animation: 300ms ease both fade-in,
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade {
|
||||||
|
view-transition-name: fade;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue