Add optional functions to with-section

This commit is contained in:
Marcus Kammer 2024-08-02 18:32:21 +02:00
parent 2f60f80d04
commit 9c79b7b5e5
Signed by: marcuskammer
GPG key ID: C374817BE285268F

View file

@ -6,9 +6,14 @@
(in-package :ml-sbt/section) (in-package :ml-sbt/section)
(defmacro with-section (headline &body body) (defmacro with-section ((headline &optional functions) &body body)
`(spinneret:with-html `(spinneret:with-html
(:section :class "mb-3" (:section :class "mb-3"
(:div :class "d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom" (:div :class "d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom"
(:h* ,headline)) (:h* ,headline)
,@(loop for (label url) on functions by #'cddr
when functions
collect `(:a :class "btn btn-outline-primary"
:href ,url
,label)))
,@body))) ,@body)))