commit 2216758d14aa8d61e2cb99ecf0d25fd5f681a80e Author: Linus Miller Date: Thu Feb 23 19:27:30 2017 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0aa8205 --- /dev/null +++ b/.gitignore @@ -0,0 +1,42 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# NPM Dependency directory +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git +node_modules + +npm-debug.log + +# Bower dependency directory +bower_components + +.tern-port + +/build + +/dump + +/public + +/server/uploads diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c1c7401 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "gulp"] + path = gulp + url = https://github.com/thebitmill/gulp.git diff --git a/assets/less/dragula.less b/assets/less/dragula.less new file mode 100644 index 0000000..3f81d2b --- /dev/null +++ b/assets/less/dragula.less @@ -0,0 +1,23 @@ +.gu-mirror { + position: fixed !important; + margin: 0 !important; + z-index: 9999 !important; + // opacity: 0.8; + // -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; + // filter: alpha(opacity=80); +} +.gu-hide { + display: none !important; +} +.gu-unselectable { + -webkit-user-select: none !important; + -moz-user-select: none !important; + -ms-user-select: none !important; + user-select: none !important; +} +.gu-transit { + display: none !important; + opacity: 0.2; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)"; + filter: alpha(opacity=20); +} diff --git a/assets/less/main.less b/assets/less/main.less new file mode 100644 index 0000000..2f548bd --- /dev/null +++ b/assets/less/main.less @@ -0,0 +1,29 @@ +@import "./dragula"; + +div.container { + margin: 0 auto; + display: flex; + > div.location { + width: 100px; + height: 100px; + padding: 40px; + &.over { + > .item { + transform: scale(1.3); + background: blue; + } + } + } +} + +div.item { + transition: all 0.2s; + width: 100px !important; + height: 100px !important; + background: red; + border-radius: 300px; + + display: flex; + justify-content: center; + align-items: center; +} diff --git a/client/index.js b/client/index.js new file mode 100644 index 0000000..e249ade --- /dev/null +++ b/client/index.js @@ -0,0 +1,55 @@ +import { $, $$ } from 'dollr'; +import dragula from 'dragula'; + + +const result = $('pre'); +const containers = $$('.location'); + +const drake = dragula(containers, { + revertOnSpill: true, + // accepts(el, target, source, sibling) { + // // console.log('accepts'); + // // console.log(target); + // return true; + + // } +}); + +drake.on('drop', (el, target, source) => { + drake.cancel(); + + if (target !== source) { + fetch('/api/trip', { + method: 'POST', + headers: { + 'content-type': 'application/json', + accepts: 'application/json', + }, + body: JSON.stringify({ + from: source.dataset.location, + to: target.dataset.location, + }), + }).then((res) => { + return res.json(); + }).then((json) => { + console.log(json); + result.textContent = JSON.stringify(json, null, ' ') + }).catch((err) => { + console.log('error'); + console.log(err); + }); + } +}); + +drake.on('over', (el, target, source) => { + if (target !== source) { + target.classList.add('over'); + } +}); + +drake.on('out', (el, target, source) => { + if (target !== source) { + target.classList.remove('over'); + } +}); + diff --git a/client/master.jsx b/client/master.jsx new file mode 100644 index 0000000..4378d37 --- /dev/null +++ b/client/master.jsx @@ -0,0 +1,26 @@ +import { h } from 'jsx-node'; + +export default ({ articleUrl, protocol, hostname, websocketsPort, INITIAL_STATE, js, css, cssFile }) => { + return '' + ( + + + Journey + + + + + + + +
+
Home
+
Office
+
Brother
+
The Rapist
+
+

+