Skip to content

Instantly share code, notes, and snippets.

@cassiomarques
Last active September 21, 2015 22:00
Show Gist options
  • Save cassiomarques/b799692d292b4a6d95cc to your computer and use it in GitHub Desktop.
Save cassiomarques/b799692d292b4a6d95cc to your computer and use it in GitHub Desktop.
(defn delete-button-component [card]
(let [delete-state (r/atom :initial)
on-delete-clicked (fn [] (reset! delete-state :confirming))
on-cancel-clicked (fn [] (reset! delete-state :initial))
delete-button [:button {:class "circular ui icon button delete-card" :title "Delete card" :on-click on-delete-clicked}
[:i {:class "icon erase"}]]
confirmation-buttons [:span
[:button {:class "ui button cancel" :on-click on-cancel-clicked} "Cancel"]
[:button {:class "ui button confirm"} "I'm sure!"]]]
(fn [card]
[:span.delete-button-component
(condp = @delete-state
:initial delete-button
:confirming confirmation-buttons)])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment