Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor to react 16 #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
23 changes: 22 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
node_modules/

# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
node_modules

# builds
build
dist
.rpt2_cache

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
22 changes: 22 additions & 0 deletions LICENSE.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2014 Jakob Miland
Copyright (c) 2018 Beanloop AB

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.
49 changes: 31 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
# react-counter

A dead-simple incremental counter component with easing animations.
>

npm install @beanloop-ab/react-counter
[![NPM](https://img.shields.io/npm/v/react-counter.svg)](https://www.npmjs.com/package/react-counter) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

```js
var React = require('react');
var Counter = require('react-counter');
## Install

React.render(
<Counter begin={0} end={1000} time={2000} easing="outCube" />,
document.body
);
```bash
npm install --save @beanloop-ab/react-counter
```

## Usage

```js
<Counter
begin={Number} // The number to count from
end={Number} // The number to count to
time={Number} // The time (in ms) the counting animation should take
easing={String} // Which easing function to use (default="outCube")
/>
```tsx
import * as React from 'react'

import {Counter} from 'react-counter'

class Example extends React.Component {
render() {
return (
<div>
<Counter from={500} to={1600} duration={2000} />
<Counter to={1000} duration={2000} easing={n => n * n} />
<Counter to={1000} duration={2000} easing={n => n} />
<Counter to={1000}>
{value => (
<p style={{color: 'red'}}>
{value} custom formatting with render prop
</p>
)}
</Counter>
</div>
)
}
}
```

The `easing` property, can be a name of any easing function from
[ease-component](https://www.npmjs.com/package/ease-component)
## License

MIT © [Beanloop](https://github.com/beanloop-ab), [Jakob Miland](https://github.com/saebekassebil)
Loading