Preserve header state during page transitions
This commit is contained in:
parent
e09e544c31
commit
68264c4655
1 changed files with 46 additions and 46 deletions
|
@ -13,7 +13,11 @@
|
||||||
|
|
||||||
(defcomp ~pc-header ()
|
(defcomp ~pc-header ()
|
||||||
(hsx
|
(hsx
|
||||||
(nav :class "hidden md:flex items-end"
|
(header :class "hidden md:flex justify-between py-4 border-b-1 top-0 bg-white"
|
||||||
|
(h1 :class "z-20 text-3xl font-bold"
|
||||||
|
(a :href "/"
|
||||||
|
"skyizwhite")))
|
||||||
|
(nav :class "flex items-end"
|
||||||
(ul :preload "mouseover" :class "flex gap-4 text-xl font-medium"
|
(ul :preload "mouseover" :class "flex gap-4 text-xl font-medium"
|
||||||
(loop
|
(loop
|
||||||
:for (href label) :in *nav-menu* :collect
|
:for (href label) :in *nav-menu* :collect
|
||||||
|
@ -25,7 +29,13 @@
|
||||||
|
|
||||||
(defcomp ~sp-header ()
|
(defcomp ~sp-header ()
|
||||||
(hsx
|
(hsx
|
||||||
(div :class "block md:hidden" :x-data "{ open: false }"
|
(header
|
||||||
|
:id "sp-header" :x-data "{ open: false }" :hx-preserve t
|
||||||
|
:class "flex md:hidden justify-between py-2 border-b-1 top-0 bg-white"
|
||||||
|
(h1 :class "z-20 text-2xl font-bold"
|
||||||
|
(a :href "/" :@click "open = false"
|
||||||
|
"skyizwhite"))
|
||||||
|
(div
|
||||||
(button
|
(button
|
||||||
:class "z-20 size-8 flex flex-col justify-center cursor-pointer relative"
|
:class "z-20 size-8 flex flex-col justify-center cursor-pointer relative"
|
||||||
:type "button"
|
:type "button"
|
||||||
|
@ -57,21 +67,11 @@
|
||||||
:preload "mousedown"
|
:preload "mousedown"
|
||||||
:class "flex flex-col h-fit gap-8 text-3xl font-medium"
|
:class "flex flex-col h-fit gap-8 text-3xl font-medium"
|
||||||
(loop
|
(loop
|
||||||
:for (href label) :in *nav-menu* :collect
|
:for (href label) :in (append '(("/" "home")) *nav-menu*) :collect
|
||||||
(if (search href (request-uri jingle:*request*))
|
(hsx (li (a :href href :@click "open = false" label))))))))))
|
||||||
(hsx (li :class "text-pink-500"
|
|
||||||
label))
|
|
||||||
(hsx (li (a
|
|
||||||
:href href
|
|
||||||
:class "hover:text-pink-500"
|
|
||||||
:@click "open = false"
|
|
||||||
label))))))))))
|
|
||||||
|
|
||||||
(defcomp ~header ()
|
(defcomp ~header ()
|
||||||
(hsx
|
(hsx
|
||||||
(header :class "flex justify-between py-2 md:py-4 border-b-1 top-0 bg-white"
|
(<>
|
||||||
(h1 :class "z-20 text-2xl md:text-3xl font-bold"
|
|
||||||
(a :href "/"
|
|
||||||
"skyizwhite"))
|
|
||||||
(~pc-header)
|
(~pc-header)
|
||||||
(~sp-header))))
|
(~sp-header))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue