diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-01-23 21:10:11 +0100 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-01-23 21:10:11 +0100 |
commit | a85257dbafe550e2bb3f62bc437e4917c3a1e86d (patch) | |
tree | a7d80f3ee290f139d934599ac5aeee6109d0711f /src | |
parent | 7b417b9cf6aac52c68390222298410d082366599 (diff) |
feat(frontend): add accordeon layout component
Diffstat (limited to 'src')
-rw-r--r-- | src/frontend/tubo/components/layout.cljs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/frontend/tubo/components/layout.cljs b/src/frontend/tubo/components/layout.cljs index 59c695c..0595ab5 100644 --- a/src/frontend/tubo/components/layout.cljs +++ b/src/frontend/tubo/components/layout.cljs @@ -63,7 +63,7 @@ (defn secondary-button [label on-click-cb left-icon right-icon] - [:button.dark:bg-transparent.bg-neutral-100.px-4.rounded-3xl.py-1.border.border-neutral-700.dark:border-stone-700.outline-none.focus:ring-transparent.whitespace-nowrap + [:button.dark:bg-transparent.bg-neutral-100.px-4.rounded-3xl.py-1.border.border-neutral-300.dark:border-stone-700.outline-none.focus:ring-transparent.whitespace-nowrap {:on-click on-click-cb} (when left-icon [:i.text-neutral-500.dark:text-white.text-sm @@ -72,3 +72,18 @@ (when right-icon [:i.text-neutral-500.dark:text-white.text-sm {:class right-icon}])]) + +(defn accordeon + [{:keys [label on-open open? left-icon right-button]} & content] + [:div.py-4 + [:div.flex.justify-between + [:div.flex.items-center.text-sm.sm:text-base + (when left-icon + [:i.w-6 {:class left-icon}]) + [:h2.mx-4.text-lg.w-24 label] + [:i.fa-solid.fa-chevron-up.cursor-pointer.text-sm + {:class (if open? "fa-chevron-up" "fa-chevron-down") + :on-click on-open}]] + right-button] + (when open? + (map-indexed #(with-meta %2 {:key %1}) content))]) |