dev.metalisp.sbt/src/component/list-group.lisp

30 lines
870 B
Common Lisp
Raw Normal View History

2023-07-08 06:59:03 +02:00
;; List groups
;; Create lists of content in a card with a flush list group.
2023-07-11 19:36:56 +02:00
(defpackage cl-sbt-list-group
(:use :cl)
(:export
:item
:list-group))
(in-package :cl-sbt-list-group)
2023-07-08 06:59:03 +02:00
(defmacro list-group-item (&body body)
2023-07-11 19:36:56 +02:00
"This macro generates a Bootstrap list group item.
BODY: The contents of the list group item."
2023-07-08 06:59:03 +02:00
`(spinneret:with-html
(:li :class "list-group-item" ,@body)))
(defmacro list-group (&rest rest)
2023-07-11 19:36:56 +02:00
"This macro generates a Bootstrap list group.
REST: A sequence of items to be included in the list group. Each item is a keyword-value pair, where the keyword is ':content' and the value is the content of the item."
2023-07-08 06:59:03 +02:00
`(spinneret:with-html
(:ul :class "list-group list-group-flush"
,@(loop for item in rest
collect (destructuring-bind (&key content) item
2023-07-11 19:36:56 +02:00
`(list-group-item ,content))))))