Files
rose-ash/blog/sx/layouts.sx
giles 7fda7a8027
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m38s
Replace env free-variable threading with IO-primitive auto-fetch macros
Layout components now self-resolve context (cart-mini, auth-menu, nav-tree,
rights, URLs) via new IO primitives (root-header-ctx, select-colours,
account-nav-ctx, app-rights) and defmacro wrappers (~root-header-auto,
~auth-header-row-auto, ~root-mobile-auto). This eliminates _ctx_to_env(),
HELPER_CSS_CLASSES, and verbose :key threading across all 10 services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 18:20:57 +00:00

52 lines
1.7 KiB
Plaintext

;; Blog layout defcomps — fully self-contained via IO primitives.
;; --- Blog header (invisible row for blog-header-child swap target) ---
(defcomp ~blog-header (&key oob)
(~menu-row-sx :id "blog-row" :level 1
:link-label-content (div)
:child-id "blog-header-child" :oob oob))
;; --- Blog layout (root + blog header) ---
(defcomp ~blog-layout-full ()
(<> (~root-header-auto)
(~blog-header)))
;; --- Settings layout (root + settings header) ---
(defcomp ~settings-layout-full (&key settings-header)
(<> (~root-header-auto)
settings-header))
;; --- Sub-settings layout (root + settings + sub row) ---
(defcomp ~sub-settings-layout-full (&key settings-header sub-header)
(<> (~root-header-auto)
settings-header sub-header))
(defcomp ~sub-settings-layout-oob (&key settings-header-oob sub-header-oob)
(<> settings-header-oob sub-header-oob))
;; --- Settings nav links — uses (select-colours) IO primitive ---
(defcomp ~blog-settings-nav ()
(let* ((sc (select-colours))
(links (list
(dict :endpoint "menu_items.defpage_menu_items_page" :icon "fa fa-bars" :label "Menu Items")
(dict :endpoint "snippets.defpage_snippets_page" :icon "fa fa-puzzle-piece" :label "Snippets")
(dict :endpoint "blog.tag_groups_admin.defpage_tag_groups_page" :icon "fa fa-tags" :label "Tag Groups")
(dict :endpoint "settings.defpage_cache_page" :icon "fa fa-refresh" :label "Cache"))))
(<> (map (lambda (lnk)
(~nav-link
:href (url-for (get lnk "endpoint"))
:icon (get lnk "icon")
:label (get lnk "label")
:select-colours (or sc "")))
links))))
;; --- Editor panel wrapper ---
(defcomp ~blog-editor-panel (&key parts)
(<> parts))