Created
May 8, 2019 13:39
-
-
Save andreortiz82/2b1b70c1fe5ff6197c7820d93365ae01 to your computer and use it in GitHub Desktop.
Drag Drop
This file contains hidden or 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
(ns gallery.prototypes.trialboard | |
(:require [cljsjs.react-beautiful-dnd] | |
[rum.core :as rum])) | |
(def drag-drop-context | |
(.createFactory js/React (.-DragDropContext js/ReactBeautifulDnd))) | |
(def droppable | |
(.createFactory js/React (.-Droppable js/ReactBeautifulDnd))) | |
(def draggable | |
(.createFactory js/React (.-Draggable js/ReactBeautifulDnd))) | |
(rum/defcs View | |
< (rum/local {:foo nil}) | |
[state] | |
(let [local-state (:rum/local state) | |
{:keys [foo]} @local-state] | |
[:main | |
[:div | |
(drag-drop-context {:onDragEnd #(js/console.log %)} | |
(droppable {:droppable-id "list" :type "my-list"} | |
[:ul | |
(map-indexed | |
(fn [index value] | |
(draggable {:draggable-id value :index index} | |
[:li value])) | |
["Larry" "Moe" "Curly" "Shemp"])]))]])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment