Add docstrings

This commit is contained in:
Marcus Kammer 2023-07-11 19:14:01 +02:00
parent 43a1b3f248
commit 31114ac89a

View file

@ -22,42 +22,84 @@
(in-package :cl-sbt-card) (in-package :cl-sbt-card)
(defmacro title (&body body) (defmacro title (&body body)
"This macro generates a Bootstrap card title.
BODY: The contents of the title."
`(spinneret:with-html `(spinneret:with-html
(:h5 :class "card-title" ,@body))) (:h5 :class "card-title" ,@body)))
(defmacro subtitle (&body body) (defmacro subtitle (&body body)
"This macro generates a Bootstrap card subtitle.
BODY: The contents of the subtitle."
`(spinneret:with-html `(spinneret:with-html
(:h6 :class "card-subtitle mb-2 text-body-secondary" ,@body))) (:h6 :class "card-subtitle mb-2 text-body-secondary" ,@body)))
(defmacro text (&body body) (defmacro text (&body body)
"This macro generates a Bootstrap card text.
BODY: The contents of the text."
`(spinneret:with-html `(spinneret:with-html
(:p :class "card-text" ,@body))) (:p :class "card-text" ,@body)))
(defmacro link ((&key (href "#")) &body body) (defmacro link ((&key (href "#")) &body body)
"This macro generates a Bootstrap card link.
HREF: The URL that the link will point to.
BODY: The contents of the link."
`(spinneret:with-html `(spinneret:with-html
(:a :href ,href :class "card-link" ,@body))) (:a :href ,href :class "card-link" ,@body)))
(defmacro header (&body body) (defmacro header (&body body)
"This macro generates a Bootstrap card header.
BODY: The contents of the header."
`(spinneret:with-html `(spinneret:with-html
(:div :class "header" ,@body))) (:div :class "header" ,@body)))
(defmacro img ((&key (src "#") (alt "Card Image"))) (defmacro img ((&key (src "#") (alt "Card Image")))
"This macro generates a Bootstrap card image.
SRC: The URL of the image.
ALT: The alt text for the image."
`(spinneret:with-html `(spinneret:with-html
(:img :src ,src (:img :src ,src
:alt ,alt :alt ,alt
:class "card-img-top"))) :class "card-img-top")))
(defmacro body (&body body) (defmacro body (&body body)
"This macro generates a Bootstrap card body.
BODY: The contents of the body."
`(spinneret:with-html `(spinneret:with-html
(:div :class "card-body" ,@body))) (:div :class "card-body" ,@body)))
(defmacro card-with-img ((&key (img-src nil)) &body body) (defmacro card-with-img ((&key (img-src nil)) &body body)
"This macro generates a Bootstrap card with an image.
IMG-SRC: The URL of the image.
BODY: The contents of the body."
`(spinneret:with-html `(spinneret:with-html
(:div :class "card" (:div :class "card"
,(if (null img-src) nil `(img (:src ,img-src))) ,(if (null img-src) nil `(img (:src ,img-src)))
(:div :class "card-body" ,@body)))) (:div :class "card-body" ,@body))))
(defmacro card (&body body) (defmacro card (&body body)
"This macro generates a Bootstrap card.
BODY: The contents of the card."
`(spinneret:with-html `(spinneret:with-html
(:div :class "card" ,@body))) (:div :class "card" ,@body)))