list-group can be a function too
This commit is contained in:
parent
8073f76ad3
commit
2bb2a5019a
1 changed files with 15 additions and 2 deletions
|
@ -20,8 +20,9 @@
|
|||
(defpackage ml-sbt/list-group
|
||||
(:use :cl)
|
||||
(:export
|
||||
:item
|
||||
:with-list-group)
|
||||
#:item
|
||||
#:list-group
|
||||
#:with-list-group)
|
||||
(:documentation "A Common Lisp package for generating Bootstrap List Group components."))
|
||||
|
||||
(in-package :ml-sbt/list-group)
|
||||
|
@ -55,6 +56,18 @@ Example:
|
|||
;; `((loop for item in ,items
|
||||
;; do (:li :class "list-group-item" item))))))))
|
||||
|
||||
(defun list-group (flush &rest items)
|
||||
"This macro generates a Bootstrap list group.
|
||||
|
||||
ITEMS: A list of items to be included in the list group.
|
||||
|
||||
FLUSH: If true, adds the 'list-group-flush' class."
|
||||
(let ((class-str (format nil "list-group~@[ list-group-flush~]" flush)))
|
||||
(spinneret:with-html
|
||||
(:ul :class class-str
|
||||
(loop for item in items
|
||||
do (:li :class "list-group-item" item))))))
|
||||
|
||||
(defmacro with-list-group (items &optional flush)
|
||||
"This macro generates a Bootstrap list group.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue