Update nav and tabs

This commit is contained in:
Marcus Kammer 2023-07-07 15:06:43 +02:00
parent 46fe449091
commit 6365f744b4
2 changed files with 20 additions and 0 deletions

View file

@ -15,6 +15,7 @@
(:file "alert")
(:file "dropdown")
(:file "table")
(:file "navbar")
(:file "header"))))
:description ""
:in-order-to ((test-op (test-op "cl-sbt/tests"))))

View file

@ -0,0 +1,19 @@
(in-package :cl-sbt)
(defun tabpanel-class (active fade)
(concatenate 'string "tab-pane " (if fade " fade " nil) (if active " in active " nil)))
(defmacro nav-item (title active url)
`(spinneret:with-html
(:li :role "presentation"
:class ,(if active "active" "")
(:a :href (format nil "#~a" ,url)
:data-toggle "tab" ,title))))
(defmacro nav ((&key (tabs nil)) &rest rest)
`(spinneret:with-html
(:ul :class "nav"
:role "tablist"
,@(loop for tab in rest
collect (destructuring-bind (&key title active id content) tab
`(tab-nav ,title ,active ,id))))))