Component names now reflect filesystem location using / as path separator and : as namespace separator for shared components: ~sx-header → ~layouts/header ~layout-app-body → ~shared:layout/app-body ~blog-admin-dashboard → ~admin/dashboard 209 files, 4,941 replacements across all services. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
79 lines
3.5 KiB
Plaintext
79 lines
3.5 KiB
Plaintext
;; Market header components
|
|
|
|
(defcomp ~headers/shop-label (&key title top-slug sub-div)
|
|
(div :class "font-bold text-xl flex-shrink-0 flex gap-2 items-center"
|
|
(div (i :class "fa fa-shop") " " title)
|
|
(div :class "flex flex-col md:flex-row md:gap-2 text-xs"
|
|
(div top-slug) (when sub-div (div sub-div)))))
|
|
|
|
(defcomp ~headers/product-label (&key title)
|
|
(<> (i :class "fa fa-shopping-bag" :aria-hidden "true") (div title)))
|
|
|
|
(defcomp ~headers/admin-link (&key href hx-select)
|
|
(a :href href :sx-get href :sx-target "#main-panel"
|
|
:sx-select hx-select :sx-swap "outerHTML" :sx-push-url "true"
|
|
:class "px-2 py-1 text-stone-500 hover:text-stone-700"
|
|
(i :class "fa fa-cog" :aria-hidden "true")))
|
|
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
;; Composition defcomps — receive data, compose component trees
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
;; Desktop category nav from pre-computed category data
|
|
(defcomp ~headers/desktop-nav-from-data (&key categories hx-select select-colours
|
|
all-href all-active admin-href)
|
|
(~navigation/desktop-category-nav
|
|
:links (<>
|
|
(~navigation/category-link :href all-href :hx-select hx-select
|
|
:active all-active :select-colours select-colours :label "All")
|
|
(map (lambda (cat)
|
|
(~navigation/category-link
|
|
:href (get cat "href") :hx-select hx-select
|
|
:active (get cat "active") :select-colours select-colours
|
|
:label (get cat "label"))) categories))
|
|
:admin (when admin-href
|
|
(~headers/admin-link :href admin-href :hx-select hx-select))))
|
|
|
|
;; Market-level header row from data
|
|
(defcomp ~headers/from-data (&key market-title top-slug sub-slug link-href
|
|
categories hx-select select-colours
|
|
all-href all-active admin-href oob)
|
|
(~shared:layout/menu-row-sx :id "market-row" :level 2
|
|
:link-href link-href
|
|
:link-label-content (~headers/shop-label
|
|
:title market-title :top-slug (or top-slug "") :sub-div sub-slug)
|
|
:nav (~headers/desktop-nav-from-data
|
|
:categories categories :hx-select hx-select :select-colours select-colours
|
|
:all-href all-href :all-active all-active :admin-href admin-href)
|
|
:child-id "market-header-child"
|
|
:oob oob))
|
|
|
|
;; Product-level header row from data
|
|
(defcomp ~headers/product-header-from-data (&key title link-href hx-select
|
|
price-data admin-href oob)
|
|
(~shared:layout/menu-row-sx :id "product-row" :level 3
|
|
:link-href link-href
|
|
:link-label-content (~headers/product-label :title title)
|
|
:nav (<>
|
|
(~prices/header-from-data
|
|
:cart-id (get price-data "cart-id")
|
|
:cart-action (get price-data "cart-action")
|
|
:csrf (get price-data "csrf")
|
|
:quantity (get price-data "quantity")
|
|
:cart-href (get price-data "cart-href")
|
|
:sp-val (get price-data "sp-val") :sp-str (get price-data "sp-str")
|
|
:rp-val (get price-data "rp-val") :rp-str (get price-data "rp-str")
|
|
:rrp-str (get price-data "rrp-str"))
|
|
(when admin-href
|
|
(~headers/admin-link :href admin-href :hx-select hx-select)))
|
|
:child-id "product-header-child"
|
|
:oob oob))
|
|
|
|
;; Product admin header row from data
|
|
(defcomp ~headers/product-admin-header-from-data (&key link-href oob)
|
|
(~shared:layout/menu-row-sx :id "product-admin-row" :level 4
|
|
:link-href link-href :link-label "admin!!" :icon "fa fa-cog"
|
|
:child-id "product-admin-header-child" :oob oob))
|
|
|