2023-07-24 08:53:42 +02:00
|
|
|
;; https://getbootstrap.com/docs/5.3/components/list-group/
|
2023-07-14 16:07:27 +02:00
|
|
|
|
|
|
|
;; Bootstrap's List Group component is a flexible and versatile component used
|
|
|
|
;; for displaying a series of content which can be a mix of various types, like
|
|
|
|
;; text, links, buttons, etc., in a list format. This component is typically
|
|
|
|
;; used for showing a list of items within a card, a sidebar, or a dropdown
|
|
|
|
;; menu.
|
|
|
|
|
|
|
|
;; The component is highly customizable, allowing for different styles and
|
|
|
|
;; effects. By default, the List Group items are styled as plain text, but can
|
|
|
|
;; be modified into clickable elements or buttons. The List Group component
|
|
|
|
;; also supports contextual classes for styling list items with different
|
|
|
|
;; states, such as success, warning, danger, and so on.
|
|
|
|
|
|
|
|
;; In addition to this, the List Group component supports adding badges to list
|
|
|
|
;; items, making it suitable for a wide range of applications, such as a list
|
|
|
|
;; of emails with the number of unread messages, a list of tasks with their
|
|
|
|
;; completion status, and so on.
|
2023-07-08 06:59:03 +02:00
|
|
|
|
2023-12-18 12:12:53 +01:00
|
|
|
(defpackage dev.metalisp.sbt/component/list-group
|
2023-07-11 19:36:56 +02:00
|
|
|
(:use :cl)
|
|
|
|
(:export
|
|
|
|
:item
|
2023-07-14 16:07:27 +02:00
|
|
|
:list-group)
|
2023-07-24 08:53:42 +02:00
|
|
|
(:documentation "A Common Lisp package for generating Bootstrap List Group components."))
|
2023-07-11 19:36:56 +02:00
|
|
|
|
2023-12-18 12:12:53 +01:00
|
|
|
(in-package :dev.metalisp.sbt/component/list-group)
|
2023-07-11 19:36:56 +02:00
|
|
|
|
2023-07-11 19:42:04 +02:00
|
|
|
(defmacro item (&body body)
|
2023-07-11 19:36:56 +02:00
|
|
|
"This macro generates a Bootstrap list group item.
|
|
|
|
|
2023-07-14 16:07:27 +02:00
|
|
|
BODY: The contents of the list group item. It should be a sequence of forms
|
|
|
|
which will be used as the contents of the list group item.
|
|
|
|
|
2023-08-06 11:15:19 +02:00
|
|
|
Example:
|
|
|
|
(item \"This is a list group item\")
|
|
|
|
(item (:p \"This is a 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.
|
|
|
|
|
2023-07-14 16:07:27 +02:00
|
|
|
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-08-06 11:15:19 +02:00
|
|
|
Example:
|
|
|
|
(list-group (:content \"First item\") (:content \"Second 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:42:04 +02:00
|
|
|
`(item ,content))))))
|