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

73 lines
2.2 KiB
Common Lisp
Raw Normal View History

2023-07-09 09:03:27 +02:00
;; https://getbootstrap.com/docs/5.3/components/alerts/
;; Provide contextual feedback messages for typical user actions with the handful
;; of available and flexible alert messages. Alerts are available for any length
;; of text, as well as an optional close button. For proper styling, use one of
;; the eight required contextual classes (e.g., .alert-success).
2023-07-01 11:28:25 +02:00
(in-package :cl-sbt)
2023-07-09 09:03:27 +02:00
(defmacro alert-btn ()
`(spinneret:with-html
(:button :type "button"
:class "btn-close"
:data-bs-dismiss "alert"
:aria-label "Close")))
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"
2023-07-09 09:03:27 +02:00
:class ,(concatenate 'string (format nil "alert alert-~a" type)
(when dismissible " alert-dismissible"))
2023-07-08 22:25:20 +02:00
,(when dismissible
2023-07-09 09:03:27 +02:00
`(alert-btn))
2023-07-08 22:25:20 +02:00
,@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))
2023-07-09 09:03:27 +02:00
(defmacro alert-primary-dismiss (&body body)
`(alert (:type "primary" :dismissible t) ,@body))
(defmacro alert-secondary-dismiss (&body body)
`(alert (:type "secondary" :dismissible t) ,@body))
(defmacro alert-success-dismiss (&body body)
`(alert (:type "success" :dismissible t) ,@body))
(defmacro alert-danger-dismiss (&body body)
`(alert (:type "danger" :dismissible t) ,@body))
(defmacro alert-warning-dismiss (&body body)
`(alert (:type "warning" :dismissible t) ,@body))
(defmacro alert-info-dismiss (&body body)
`(alert (:type "info" :dismissible t) ,@body))
(defmacro alert-light-dismiss (&body body)
`(alert (:type "light" :dismissible t) ,@body))
(defmacro alert-dark-dismiss (&body body)
`(alert (:type "dark" :dismissible t) ,@body))