Create macros for navbar

This commit is contained in:
Marcus Kammer 2024-05-26 22:38:14 +02:00
parent 2dee894ec7
commit b45a446681
Signed by: marcuskammer
GPG key ID: C374817BE285268F

View file

@ -1,17 +1,47 @@
(in-package :dev.metalisp.survey) (in-package :dev.metalisp.survey)
(defmacro navbar-nav (&body body)
`(spinneret:with-html
(:div :class "collapse navbar-collapse"
:id "#mainNav"
(:ul :class "navbar-nav"
,@(loop for navitem on body by #'cddr
collect
`(:li :class "nav-item"
(:a :class "nav-link"
:href ,(first navitem)
,(second navitem))))))))
(defmacro navbar-en ()
`(spinneret:with-html
(:nav :class "navbar bg-body-tertiary navbar-expand-sm mb-5"
(:div :class "container-fluid"
;; brand
(:a :class "navbar-brand"
:href "#"
(:img :src "/src/assets/company_logo.png"
:alt "Company Logo"
:width 100))
;; toggle button
(:button :class "navbar-toggler"
:type "button"
:data-bs-toggle "collapse"
:data-bs-target "#mainNav"
:aria-controls "#mainNav"
:aria-expanded "false"
:aria-label "Toggle Navigation"
(:span :class "navbar-toggler-icon"))
;; nav
(navbar-nav "/" "Home" "/imprint" "Imprint")))))
(defun sus-form-en () (defun sus-form-en ()
(with-page (:title "SUS Form" :main-con t) (with-page (:title "SUS Form" :main-con t)
(navbar* (navbar-en)
"sm"
(:url "#" :src "/src/assets/company_logo.png" :width 100)
"#mainNav"
((:url "/" :name "Home")))
(:h2 "Usability Feedback Form") (:h2 "Usability Feedback Form")
(:p "Please fill out the following forms and press the submit button.") (:p "Please fill out the following forms and press the submit button.")
(:form :action "/submit" (:form :action "/submit"
:method "post" :method "post"
:class (spacing :property "m" :side "y" :size 5) :class (dev.metalisp.sbt/utility:spacing :property "m" :side "y" :size 5)
(multi-form (multi-form
(:ask "Id like to use this system frequently." (:ask "Id like to use this system frequently."
:group "sus-1" :group "sus-1"