Created
December 19, 2015 14:53
-
-
Save 0xqd/2505dcff4f53c4b9ceeb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn accordion-test | |
[x] | |
(let [{:keys [title content active?]} x] | |
[:div.accordion | |
{:class (when active? "active")} | |
[:div.title | |
{:on-click #(prn "something") | |
:style {:cursor "pointer"}} | |
title] | |
[:div.content | |
{:style {:max-height 0 | |
:overflow "hidden" | |
:transition "all .15s ease"}} | |
content]])) | |
(accordion-test {:a "a" | |
:b "b"}) | |
(defui Accordions | |
Object | |
(render | |
[this] | |
(let [accordions [{:title "Title 1" | |
:content "Content 1" | |
:active? true} | |
{:title "Title 2" | |
:content "Content 2" | |
:active? false} | |
]] | |
(sab/html | |
[:div.accordions | |
(map #(accordion-test %) accordions)])))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment