Use local var for class string
This commit is contained in:
parent
1867223593
commit
932bbdb9d7
1 changed files with 7 additions and 6 deletions
|
@ -32,17 +32,18 @@
|
||||||
(defmacro badge ((&key (color "primary") (pill nil)) &body body)
|
(defmacro badge ((&key (color "primary") (pill nil)) &body body)
|
||||||
"This macro generates a Bootstrap badge.
|
"This macro generates a Bootstrap badge.
|
||||||
|
|
||||||
COLOR: (optional) The type of the badge (like 'primary', 'secondary', 'success', etc.). Defaults to 'primary'.
|
COLOR: The type of the badge (like 'primary', 'secondary', 'success', etc.). Defaults to 'primary'.
|
||||||
|
|
||||||
BODY: The contents of the badge.
|
BODY: The contents of the badge.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
(badge (:color \"success\" :pill t) \"New\")"
|
(badge (:color \"success\" :pill t) \"New\")"
|
||||||
`(spinneret:with-html
|
(let ((class-str (concatenate 'string
|
||||||
(:span :class ,(concatenate 'string
|
|
||||||
(format nil "badge text-bg-~a" color)
|
(format nil "badge text-bg-~a" color)
|
||||||
(if (null pill) "" " rounded-pill"))
|
(if (null pill) "" " rounded-pill"))))
|
||||||
,@body)))
|
`(spinneret:with-html
|
||||||
|
(:span :class ,class-str
|
||||||
|
,@body))))
|
||||||
|
|
||||||
(defmacro define-badge (color &optional (pill nil))
|
(defmacro define-badge (color &optional (pill nil))
|
||||||
"This macro defines a new macro for creating a Bootstrap badge of a specific type.
|
"This macro defines a new macro for creating a Bootstrap badge of a specific type.
|
||||||
|
|
Loading…
Add table
Reference in a new issue