Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
  • Loading branch information
evenchange4 committed Mar 20, 2018
0 parents commit ab31373
Show file tree
Hide file tree
Showing 58 changed files with 24,899 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"presets": [
"babel-preset-react-app",
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
],
"plugins": [
"babel-plugin-add-module-exports"
]
}
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
11 changes: 11 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[ignore]

[include]

[libs]

[lints]

[options]

[strict]
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/storybook-static
/lib

# misc
.DS_Store
npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9.8.0
4 changes: 4 additions & 0 deletions .storybook/addon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @flow
import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';
import '@storybook/addon-options/register';
19 changes: 19 additions & 0 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// @flow
import { configure, addDecorator, setAddon } from '@storybook/react';
import infoAddon, { setDefaults } from '@storybook/addon-info';
import { setOptions } from '@storybook/addon-options';

setAddon(infoAddon);
setDefaults({ inline: true });
setOptions({
name: 'react-draggable-playground',
url: 'https://github.com/evenchange4/react-draggable-playground',
sortStoriesByKind: true,
});

const context = (require: any).context('../src/', true, /\.example\.js$/);
function loadStories() {
context.keys().forEach(context);
}

configure(loadStories, module);
44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
sudo: false
language: node_js
node_js:
- "9.8.0"

env:
global:
- YARN_VERSION=1.5.1

before_install:
- export PATH="$HOME/.yarn/bin:$PATH"
- |
if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
fi
script:
- yarn run eslint
- yarn run test
- yarn run flow
- yarn run build
- yarn run build-storybook

after_success:
- ./node_modules/.bin/codecov

deploy:
- provider: npm
email: evenchange4@gmail.com
api_key:
secure:
skip_cleanup: true
on:
tags: true
repo: evenchange4/react-draggable-playground

cache:
yarn: true
directories:
- "~/.yarn"
- node_modules

notifications:
email: evenchange4@gmail.com
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2018 Michael Hsu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
119 changes: 119 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# react-draggable-playground

> Reusable React-draggable components with render props.
[![Travis][build-badge]][build]
[![Codecov Status][codecov-badge]][codecov]
[![npm package][npm-badge]][npm]
[![npm downloads][npm-downloads]][npm]

[![Dependency Status][dependency-badge]][dependency]
[![devDependency Status][devdependency-badge]][devdependency]
[![peerDependency Status][peerdependency-badge]][peerdependency]

[![prettier][prettier-badge]][prettier]
[![license][license-badge]][license]

## Installation

```sh
$ yarn add react-draggable-playground
```

## Demo

* https://react-draggable-playground.netlify.com/

## Usage

```js
import { DraggableParent, DraggableItem } from 'react-draggable-playground';

<DraggableParent height={300} width={300}>
<DraggableItem
defaultPosition={{ x: 100, y: 100 }}
onPositionChange={(position: Position) => {}}
>
{({ isDragging }) => <div>item</div>}
</DraggableItem>
</DraggableParent>;
```

## API

```js
type Position = {
x: number,
y: number,
};

// DraggableItem
type Props = {
children: ({ isDragging: boolean, disabled: boolean }) => React.Node,
disabled: boolean,
onPositionChange?: Position => Promise<void> | void,
defaultPosition?: Position,
};

// DraggableParent
type Props = {
height: number,
width: number,
children?: React.Node,
style?: Object,
};
```

## Development

### Requirements

* node >= 9.8.0
* yarn >= 1.5.1

```sh
$ yarn install --pure-lockfile
$ yarn start
```

## Test

```sh
$ yarn run format
$ yarn run eslint
$ yarn run flow
$ yarn run test:watch
$ yarn run build
```

---

## CONTRIBUTING

* ⇄ Pull requests and ★ Stars are always welcome.
* For bugs and feature requests, please create an issue.
* Pull requests must be accompanied by passing automated tests.

## [CHANGELOG](CHANGELOG.md)

## [LICENSE](LICENSE)

MIT: [http://michaelhsu.mit-license.org](http://michaelhsu.mit-license.org)

[build-badge]: https://img.shields.io/travis/evenchange4/react-draggable-playground/master.svg?style=flat-square
[build]: https://travis-ci.org/evenchange4/react-draggable-playground
[npm-badge]: https://img.shields.io/npm/v/react-draggable-playground.svg?style=flat-square
[npm]: https://www.npmjs.org/package/react-draggable-playground
[codecov-badge]: https://img.shields.io/codecov/c/github/evenchange4/react-draggable-playground.svg?style=flat-square
[codecov]: https://codecov.io/github/evenchange4/react-draggable-playground?branch=master
[npm-downloads]: https://img.shields.io/npm/dt/react-draggable-playground.svg?style=flat-square
[license-badge]: https://img.shields.io/npm/l/react-draggable-playground.svg?style=flat-square
[license]: http://michaelhsu.mit-license.org/
[dependency-badge]: https://david-dm.org/evenchange4/react-draggable-playground.svg?style=flat-square
[dependency]: https://david-dm.org/evenchange4/react-draggable-playground
[devdependency-badge]: https://david-dm.org/evenchange4/react-draggable-playground/dev-status.svg?style=flat-square
[devdependency]: https://david-dm.org/evenchange4/react-draggable-playground#info=devDependencies
[peerdependency-badge]: https://david-dm.org/evenchange4/react-draggable-playground/peer-status.svg?style=flat-square
[peerdependency]: https://david-dm.org/evenchange4/react-draggable-playground#info=peerDependencies
[prettier-badge]: https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=flat-square
[prettier]: https://github.com/prettier/prettier
80 changes: 80 additions & 0 deletions flow-typed/npm/@babel/cli_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// flow-typed signature: 368351798c02e60f4d574411da535028
// flow-typed version: <<STUB>>/@babel/cli_v7.0.0-beta.42/flow_v0.68.0

/**
* This is an autogenerated libdef stub for:
*
* '@babel/cli'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module '@babel/cli' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@babel/cli/bin/babel-external-helpers' {
declare module.exports: any;
}

declare module '@babel/cli/bin/babel' {
declare module.exports: any;
}

declare module '@babel/cli/lib/babel-external-helpers' {
declare module.exports: any;
}

declare module '@babel/cli/lib/babel/dir' {
declare module.exports: any;
}

declare module '@babel/cli/lib/babel/file' {
declare module.exports: any;
}

declare module '@babel/cli/lib/babel/index' {
declare module.exports: any;
}

declare module '@babel/cli/lib/babel/util' {
declare module.exports: any;
}

// Filename aliases
declare module '@babel/cli/bin/babel-external-helpers.js' {
declare module.exports: $Exports<'@babel/cli/bin/babel-external-helpers'>;
}
declare module '@babel/cli/bin/babel.js' {
declare module.exports: $Exports<'@babel/cli/bin/babel'>;
}
declare module '@babel/cli/index' {
declare module.exports: $Exports<'@babel/cli'>;
}
declare module '@babel/cli/index.js' {
declare module.exports: $Exports<'@babel/cli'>;
}
declare module '@babel/cli/lib/babel-external-helpers.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel-external-helpers'>;
}
declare module '@babel/cli/lib/babel/dir.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/dir'>;
}
declare module '@babel/cli/lib/babel/file.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/file'>;
}
declare module '@babel/cli/lib/babel/index.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/index'>;
}
declare module '@babel/cli/lib/babel/util.js' {
declare module.exports: $Exports<'@babel/cli/lib/babel/util'>;
}

0 comments on commit ab31373

Please sign in to comment.