diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e8bdb0c --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +repl-temp-* +.pulp* +dist +cabal-dev +.cabal-sandbox +cabal.sandbox.config +*.o +*.hi +*.chi +*.chs.h +*.lksh* +.virthualenv +.psci_modules/ +.test_modules/ +bower_components/ +node_modules +tmp/ +.stack-work/ +output +examples/docs/docs/ +core-tests/full-core-docs.md +.psc-ide-port diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..bf124b2 --- /dev/null +++ b/bower.json @@ -0,0 +1,23 @@ +{ + "name": "purescript-sortable-hoc", + "description": "Purescript wrapper for purescript-sortable-hoc", + "authors": "Vishnu Prasad ", + "license": "MIT", + "keywords": [ + "purescript", + "react", + "drag-drop", + ], + "homepage": "", + "private": true, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "purescript-react": "^2.0.0" + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..1d0778e --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "purescript-sortable-hoc", + "version": "1.0.0", + "description": "Purescript wrapper for purescript-sortable-hoc", + "main": "index.js", + "repository": "atomicits/purescript-sortable-hoc", + "author": "Vishnu Prasad ", + "license": "MIT", + "dependencies": { + "react-sortable-hoc": "^0.6.1" + } +} diff --git a/src/SortableHoc.js b/src/SortableHoc.js new file mode 100644 index 0000000..c188e79 --- /dev/null +++ b/src/SortableHoc.js @@ -0,0 +1,41 @@ +'use strict'; + +var reactSortableHoc = require("react-sortable-hoc"); + +exports.sortableContainer = function(element){ + return function(config){ + return function(){ + return reactSortableHoc.sortableContainer(element, config); + }; + }; +}; + + +exports.sortableElement = function(element){ + return function(config){ + return function(){ + return reactSortableHoc.sortableElement(element, config); + }; + }; +}; + + +exports.sortableHandle = function(element){ + return function(config){ + return function(){ + return reactSortableHoc.sortableHandle(element, config); + }; + }; +}; + + +exports.arrayMove = function(array){ + return function(prevIndex){ + return function(newIndex){ + return function(){ + return reactSortableHoc.arrayMove(array, prevIndex, newIndex); + }; + + }; + }; +}; diff --git a/src/SortableHoc.purs b/src/SortableHoc.purs new file mode 100644 index 0000000..13d2339 --- /dev/null +++ b/src/SortableHoc.purs @@ -0,0 +1,27 @@ +module SortableHoc where + +import React (ReactElement) +import Control.Monad.Eff (Eff) + +type Config = {withRef :: Boolean} + +foreign import sortableContainer :: forall e. ReactElement + -> Config + -> Eff e ReactElement + + +foreign import sortableElement :: forall e. ReactElement + -> Config + -> Eff e ReactElement + + +foreign import sortableHandle :: forall e. ReactElement + -> Config + -> Eff e ReactElement + + + +foreign import arrayMove :: forall e a. Array a + -> Int + -> Int + -> Eff e (Array a) diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..eaae3ac --- /dev/null +++ b/yarn.lock @@ -0,0 +1,7 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +react-native-parallax-scroll-view@^0.19.0: + version "0.19.0" + resolved "https://registry.yarnpkg.com/react-native-parallax-scroll-view/-/react-native-parallax-scroll-view-0.19.0.tgz#23b9af1f13249a610f4641e2582a58997df7d80a"