Simplify with-navbar interface
This commit is contained in:
parent
afd66328e4
commit
08d60db002
1 changed files with 9 additions and 7 deletions
|
@ -35,6 +35,8 @@
|
||||||
:con
|
:con
|
||||||
:row)
|
:row)
|
||||||
(:export
|
(:export
|
||||||
|
:*brand-name*
|
||||||
|
:*brand-url*
|
||||||
:with-navbar
|
:with-navbar
|
||||||
:navbar
|
:navbar
|
||||||
:brand
|
:brand
|
||||||
|
@ -224,21 +226,21 @@ Example:
|
||||||
,(getf navitem :name))))))
|
,(getf navitem :name))))))
|
||||||
nil))))))
|
nil))))))
|
||||||
|
|
||||||
(defmacro with-navbar ((&key (brand "My Brand") (brand-url "/") active-item) &rest items)
|
(defparameter *brand-name* "My Brand")
|
||||||
|
|
||||||
|
(defparameter *brand-url* "/")
|
||||||
|
|
||||||
|
(defmacro with-navbar (container active-item &rest items)
|
||||||
"Creates a Bootstrap navigation bar.
|
"Creates a Bootstrap navigation bar.
|
||||||
|
|
||||||
BRAND: The brand name to display (default: \"My Brand\")
|
|
||||||
|
|
||||||
BRAND-URL: The URL for the brand link (default: \"/\")
|
|
||||||
|
|
||||||
ACTIVE-ITEM: The key of the currently active item
|
ACTIVE-ITEM: The key of the currently active item
|
||||||
|
|
||||||
ITEMS: A plist of nav items in the form of :key \"url\" pairs"
|
ITEMS: A plist of nav items in the form of :key \"url\" pairs"
|
||||||
`(spinneret:with-html
|
`(spinneret:with-html
|
||||||
(:nav :class "navbar navbar-expand-lg bg-body-tertiary mb-5"
|
(:nav :class "navbar navbar-expand-lg bg-body-tertiary mb-5"
|
||||||
:aria-label "Main"
|
:aria-label "Main"
|
||||||
(:div :class "container"
|
(:div :class ,container
|
||||||
(:a :class "navbar-brand" :href ,brand-url ,brand)
|
(:a :class "navbar-brand" :href ,*brand-url* ,*brand-name*)
|
||||||
(:button :class "navbar-toggler" :type "button"
|
(:button :class "navbar-toggler" :type "button"
|
||||||
:data-bs-toggle "collapse" :data-bs-target "#navbarNav"
|
:data-bs-toggle "collapse" :data-bs-target "#navbarNav"
|
||||||
:aria-controls "navbarNav" :aria-expanded "false" :aria-label "Toggle navigation"
|
:aria-controls "navbarNav" :aria-expanded "false" :aria-label "Toggle navigation"
|
||||||
|
|
Loading…
Add table
Reference in a new issue