Move market composition from Python to .sx defcomps (Phase 3)
Python sxc/pages/ functions no longer build nested sx_call chains or reference leaf component names. Instead they extract data (URLs, prices, CSRF, cart state) and call a single top-level composition defcomp with pure data values. The .sx defcomps handle all component-to-component wiring, iteration (map), and conditional rendering. New .sx composition defcomps: - headers.sx: ~market-header-from-data, ~market-desktop-nav-from-data, ~market-product-header-from-data, ~market-product-admin-header-from-data - prices.sx: ~market-prices-header-from-data, ~market-card-price-from-data - navigation.sx: ~market-mobile-nav-from-data - cards.sx: ~market-product-cards-content, ~market-card-from-data, ~market-cards-content, ~market-landing-from-data - detail.sx: ~market-product-detail-from-data, ~market-detail-gallery-from-data, ~market-detail-info-from-data - meta.sx: ~market-product-meta-from-data - filters.sx: ~market-desktop-filter-from-data, ~market-mobile-chips-from-data, ~market-mobile-filter-content-from-data, plus 6 sub-composition defcomps Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -61,3 +61,37 @@
|
||||
(defcomp ~market-mobile-cat-details (&key open summary subs)
|
||||
(details :class "group/cat py-1" :open open
|
||||
summary subs))
|
||||
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; Composition: mobile nav panel from pre-computed category data
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(defcomp ~market-mobile-nav-from-data (&key categories all-href all-active hx-select select-colours)
|
||||
(~market-mobile-nav-wrapper :items
|
||||
(<>
|
||||
(~market-mobile-all-link :href all-href :hx-select hx-select
|
||||
:active all-active :select-colours select-colours)
|
||||
(map (lambda (cat)
|
||||
(~market-mobile-cat-details
|
||||
:open (get cat "active")
|
||||
:summary (~market-mobile-cat-summary
|
||||
:bg-cls (if (get cat "active") " bg-stone-900 text-white hover:bg-stone-900" "")
|
||||
:href (get cat "href") :hx-select hx-select
|
||||
:select-colours select-colours :cat-name (get cat "name")
|
||||
:count-label (str (get cat "count") " products")
|
||||
:count-str (str (get cat "count"))
|
||||
:chevron (~market-mobile-chevron))
|
||||
:subs (if (get cat "subs")
|
||||
(~market-mobile-subs-panel :links
|
||||
(<> (map (lambda (sub)
|
||||
(~market-mobile-sub-link
|
||||
:select-colours select-colours
|
||||
:active (get sub "active")
|
||||
:href (get sub "href") :hx-select hx-select
|
||||
:label (get sub "label")
|
||||
:count-label (str (get sub "count") " products")
|
||||
:count-str (str (get sub "count"))))
|
||||
(get cat "subs"))))
|
||||
(~market-mobile-view-all :href (get cat "href") :hx-select hx-select))))
|
||||
categories))))
|
||||
|
||||
Reference in New Issue
Block a user