diff --git a/cl-sbt.asd b/cl-sbt.asd index 9fbf494..ef84f16 100644 --- a/cl-sbt.asd +++ b/cl-sbt.asd @@ -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")))) diff --git a/src/component/nav-tab.lisp b/src/component/nav-tab.lisp new file mode 100644 index 0000000..6f84a2a --- /dev/null +++ b/src/component/nav-tab.lisp @@ -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))))))