Skip to content

Commit ab31373

Browse files
committed
feat: init
0 parents  commit ab31373

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+24899
-0
lines changed

.babelrc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"presets": [
3+
"babel-preset-react-app",
4+
[
5+
"@babel/preset-env",
6+
{
7+
"targets": {
8+
"node": "current"
9+
}
10+
}
11+
]
12+
],
13+
"plugins": [
14+
"babel-plugin-add-module-exports"
15+
]
16+
}

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[Makefile]
16+
indent_style = tab

.flowconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[ignore]
2+
3+
[include]
4+
5+
[libs]
6+
7+
[lints]
8+
9+
[options]
10+
11+
[strict]

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
6+
# testing
7+
/coverage
8+
9+
# production
10+
/storybook-static
11+
/lib
12+
13+
# misc
14+
.DS_Store
15+
npm-debug.log*
16+
yarn-debug.log*
17+
yarn-error.log*

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9.8.0

.storybook/addon.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// @flow
2+
import '@storybook/addon-actions/register';
3+
import '@storybook/addon-links/register';
4+
import '@storybook/addon-options/register';

.storybook/config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// @flow
2+
import { configure, addDecorator, setAddon } from '@storybook/react';
3+
import infoAddon, { setDefaults } from '@storybook/addon-info';
4+
import { setOptions } from '@storybook/addon-options';
5+
6+
setAddon(infoAddon);
7+
setDefaults({ inline: true });
8+
setOptions({
9+
name: 'react-draggable-playground',
10+
url: 'https://github.com/evenchange4/react-draggable-playground',
11+
sortStoriesByKind: true,
12+
});
13+
14+
const context = (require: any).context('../src/', true, /\.example\.js$/);
15+
function loadStories() {
16+
context.keys().forEach(context);
17+
}
18+
19+
configure(loadStories, module);

.travis.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- "9.8.0"
5+
6+
env:
7+
global:
8+
- YARN_VERSION=1.5.1
9+
10+
before_install:
11+
- export PATH="$HOME/.yarn/bin:$PATH"
12+
- |
13+
if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then
14+
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
15+
fi
16+
17+
script:
18+
- yarn run eslint
19+
- yarn run test
20+
- yarn run flow
21+
- yarn run build
22+
- yarn run build-storybook
23+
24+
after_success:
25+
- ./node_modules/.bin/codecov
26+
27+
deploy:
28+
- provider: npm
29+
email: evenchange4@gmail.com
30+
api_key:
31+
secure:
32+
skip_cleanup: true
33+
on:
34+
tags: true
35+
repo: evenchange4/react-draggable-playground
36+
37+
cache:
38+
yarn: true
39+
directories:
40+
- "~/.yarn"
41+
- node_modules
42+
43+
notifications:
44+
email: evenchange4@gmail.com

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018 Michael Hsu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# react-draggable-playground
2+
3+
> Reusable React-draggable components with render props.
4+
5+
[![Travis][build-badge]][build]
6+
[![Codecov Status][codecov-badge]][codecov]
7+
[![npm package][npm-badge]][npm]
8+
[![npm downloads][npm-downloads]][npm]
9+
10+
[![Dependency Status][dependency-badge]][dependency]
11+
[![devDependency Status][devdependency-badge]][devdependency]
12+
[![peerDependency Status][peerdependency-badge]][peerdependency]
13+
14+
[![prettier][prettier-badge]][prettier]
15+
[![license][license-badge]][license]
16+
17+
## Installation
18+
19+
```sh
20+
$ yarn add react-draggable-playground
21+
```
22+
23+
## Demo
24+
25+
* https://react-draggable-playground.netlify.com/
26+
27+
## Usage
28+
29+
```js
30+
import { DraggableParent, DraggableItem } from 'react-draggable-playground';
31+
32+
<DraggableParent height={300} width={300}>
33+
<DraggableItem
34+
defaultPosition={{ x: 100, y: 100 }}
35+
onPositionChange={(position: Position) => {}}
36+
>
37+
{({ isDragging }) => <div>item</div>}
38+
</DraggableItem>
39+
</DraggableParent>;
40+
```
41+
42+
## API
43+
44+
```js
45+
type Position = {
46+
x: number,
47+
y: number,
48+
};
49+
50+
// DraggableItem
51+
type Props = {
52+
children: ({ isDragging: boolean, disabled: boolean }) => React.Node,
53+
disabled: boolean,
54+
onPositionChange?: Position => Promise<void> | void,
55+
defaultPosition?: Position,
56+
};
57+
58+
// DraggableParent
59+
type Props = {
60+
height: number,
61+
width: number,
62+
children?: React.Node,
63+
style?: Object,
64+
};
65+
```
66+
67+
## Development
68+
69+
### Requirements
70+
71+
* node >= 9.8.0
72+
* yarn >= 1.5.1
73+
74+
```sh
75+
$ yarn install --pure-lockfile
76+
$ yarn start
77+
```
78+
79+
## Test
80+
81+
```sh
82+
$ yarn run format
83+
$ yarn run eslint
84+
$ yarn run flow
85+
$ yarn run test:watch
86+
$ yarn run build
87+
```
88+
89+
---
90+
91+
## CONTRIBUTING
92+
93+
* ⇄ Pull requests and ★ Stars are always welcome.
94+
* For bugs and feature requests, please create an issue.
95+
* Pull requests must be accompanied by passing automated tests.
96+
97+
## [CHANGELOG](CHANGELOG.md)
98+
99+
## [LICENSE](LICENSE)
100+
101+
MIT: [http://michaelhsu.mit-license.org](http://michaelhsu.mit-license.org)
102+
103+
[build-badge]: https://img.shields.io/travis/evenchange4/react-draggable-playground/master.svg?style=flat-square
104+
[build]: https://travis-ci.org/evenchange4/react-draggable-playground
105+
[npm-badge]: https://img.shields.io/npm/v/react-draggable-playground.svg?style=flat-square
106+
[npm]: https://www.npmjs.org/package/react-draggable-playground
107+
[codecov-badge]: https://img.shields.io/codecov/c/github/evenchange4/react-draggable-playground.svg?style=flat-square
108+
[codecov]: https://codecov.io/github/evenchange4/react-draggable-playground?branch=master
109+
[npm-downloads]: https://img.shields.io/npm/dt/react-draggable-playground.svg?style=flat-square
110+
[license-badge]: https://img.shields.io/npm/l/react-draggable-playground.svg?style=flat-square
111+
[license]: http://michaelhsu.mit-license.org/
112+
[dependency-badge]: https://david-dm.org/evenchange4/react-draggable-playground.svg?style=flat-square
113+
[dependency]: https://david-dm.org/evenchange4/react-draggable-playground
114+
[devdependency-badge]: https://david-dm.org/evenchange4/react-draggable-playground/dev-status.svg?style=flat-square
115+
[devdependency]: https://david-dm.org/evenchange4/react-draggable-playground#info=devDependencies
116+
[peerdependency-badge]: https://david-dm.org/evenchange4/react-draggable-playground/peer-status.svg?style=flat-square
117+
[peerdependency]: https://david-dm.org/evenchange4/react-draggable-playground#info=peerDependencies
118+
[prettier-badge]: https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=flat-square
119+
[prettier]: https://github.com/prettier/prettier

0 commit comments

Comments
 (0)