2023-07-08 14:32:59 +02:00
|
|
|
;; https://getbootstrap.com/docs/5.3/components/accordion/
|
|
|
|
|
2023-07-01 16:30:10 +02:00
|
|
|
(in-package :cl-sbt)
|
|
|
|
|
2023-07-08 14:31:53 +02:00
|
|
|
(defmacro accordion-header (target title)
|
2023-07-08 12:49:10 +02:00
|
|
|
`(spinneret:with-html
|
2023-07-08 14:31:53 +02:00
|
|
|
(:h2 :class "accordion-header"
|
|
|
|
(:button :class "accordion-button"
|
|
|
|
:type "button"
|
|
|
|
:data-bs-toggle "collapse"
|
|
|
|
:data-bs-target (format nil "#~a" ,target)
|
|
|
|
:aria-expanded "true"
|
|
|
|
:aria-controls "collapseOne"
|
|
|
|
,title))))
|
2023-07-08 12:49:10 +02:00
|
|
|
|
|
|
|
(defmacro accordion-item (&body body)
|
2023-07-08 14:31:53 +02:00
|
|
|
`(spinneret:with-html
|
|
|
|
(:div :class "accordion-item"
|
|
|
|
,@body)))
|
2023-07-01 16:30:10 +02:00
|
|
|
|
2023-07-08 14:31:53 +02:00
|
|
|
(defmacro accordion ((&key (id "accordionExample")) &rest rest)
|
|
|
|
`(spinneret:with-html
|
|
|
|
(:div :class "accordion"
|
|
|
|
:id ,id
|
|
|
|
,@(loop for item in rest
|
|
|
|
collect (destructuring-bind (&key id title) item
|
|
|
|
`(accordion-item (accordion-header ,id ,title)))))))
|