dev.metalisp.sbt/src/component/alert.lisp

40 lines
1.1 KiB
Common Lisp
Raw Normal View History

2023-07-01 11:28:25 +02:00
(in-package :cl-sbt)
2023-07-01 16:30:10 +02:00
(defmacro alert ((&key (type nil) (dismissible nil)) &body body)
2023-07-01 11:28:25 +02:00
`(spinneret:with-html
2023-07-08 22:25:20 +02:00
(:div :role "alert"
:class ,(if dismissible
(format nil "alert alert-~a alert-dismissible" type)
(format nil "alert alert-~a" type))
,(when dismissible
`(:button :type "button"
:class "close"
:data-dismiss "alert"
:aria-label "Close"
(:span :aria-hidden "true" "×")))
,@body)))
2023-07-01 13:16:55 +02:00
2023-07-01 16:30:10 +02:00
(defmacro alert-primary (&body body)
`(alert (:type "primary") ,@body))
2023-07-01 13:16:55 +02:00
2023-07-01 16:30:10 +02:00
(defmacro alert-secondary (&body body)
`(alert (:type "secondary") ,@body))
2023-07-01 13:16:55 +02:00
2023-07-01 16:30:10 +02:00
(defmacro alert-success (&body body)
`(alert (:type "success") ,@body))
2023-07-01 13:16:55 +02:00
2023-07-01 16:30:10 +02:00
(defmacro alert-danger (&body body)
`(alert (:type "danger") ,@body))
2023-07-01 13:16:55 +02:00
2023-07-01 16:30:10 +02:00
(defmacro alert-warning (&body body)
`(alert (:type "warning") ,@body))
2023-07-01 13:16:55 +02:00
2023-07-01 16:30:10 +02:00
(defmacro alert-info (&body body)
`(alert (:type "info") ,@body))
2023-07-01 13:16:55 +02:00
2023-07-01 16:30:10 +02:00
(defmacro alert-light (&body body)
`(alert (:type "light") ,@body))
2023-07-01 13:16:55 +02:00
2023-07-01 16:30:10 +02:00
(defmacro alert-dark (&body body)
`(alert (:type "dark") ,@body))