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