mirror of https://github.com/status-im/reagent.git
Use global-exports for react-sortable-hoc example
This commit is contained in:
parent
ad5475ca1f
commit
83c0cdd698
|
@ -3,7 +3,7 @@
|
|||
[org.clojure/clojurescript "1.10.597"]
|
||||
[reagent "0.10.0"]
|
||||
[figwheel "0.5.19"]
|
||||
[cljsjs/react-sortable-hoc "1.11.0-0"]]
|
||||
[cljsjs/react-sortable-hoc "1.11.0-1"]]
|
||||
|
||||
:plugins [[lein-cljsbuild "1.1.7"]
|
||||
[lein-figwheel "0.5.19"]]
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
(ns example.core
|
||||
(:require [reagent.core :as r]
|
||||
[reagent.dom :as rdom]
|
||||
;; FIXME: add global-exports support
|
||||
[cljsjs.react-sortable-hoc]
|
||||
[react-sortable-hoc :as sort]
|
||||
[goog.object :as gobj]))
|
||||
|
||||
;; Adapted from https://github.com/clauderic/react-sortable-hoc/blob/master/examples/drag-handle.js#L10
|
||||
|
||||
(def DragHandle
|
||||
(js/SortableHOC.SortableHandle.
|
||||
(sort/SortableHandle.
|
||||
;; Alternative to r/reactify-component, which doens't convert props and hiccup,
|
||||
;; is to just provide fn as component and use as-element or create-element
|
||||
;; to return React elements from the component.
|
||||
|
@ -16,7 +15,7 @@
|
|||
(r/as-element [:span "::"]))))
|
||||
|
||||
(def SortableItem
|
||||
(js/SortableHOC.SortableElement.
|
||||
(sort/SortableElement.
|
||||
(r/reactify-component
|
||||
(fn [{:keys [value]}]
|
||||
[:li
|
||||
|
@ -27,7 +26,7 @@
|
|||
;; props is JS object here
|
||||
#_
|
||||
(def SortableItem
|
||||
(js/SortableHOC.SortableElement.
|
||||
(sort/SortableElement.
|
||||
(fn [props]
|
||||
(r/as-element
|
||||
[:li
|
||||
|
@ -35,7 +34,7 @@
|
|||
(.-value props)]))))
|
||||
|
||||
(def SortableList
|
||||
(js/SortableHOC.SortableContainer.
|
||||
(sort/SortableContainer.
|
||||
(r/reactify-component
|
||||
(fn [{:keys [items]}]
|
||||
[:ul
|
||||
|
|
Loading…
Reference in New Issue