Skip to content

Commit c4ee668

Browse files
committed
feat: refactor to react 16
- refactor out dependencies - use create-react-library - support react 15 || 16
1 parent 23495db commit c4ee668

23 files changed

+17353
-322
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.gitignore

+22-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
node_modules/
1+
2+
# See https://help.github.com/ignore-files/ for more about ignoring files.
3+
4+
# dependencies
5+
node_modules
6+
7+
# builds
8+
build
9+
dist
10+
.rpt2_cache
11+
12+
# misc
13+
.DS_Store
14+
.env
15+
.env.local
16+
.env.development.local
17+
.env.test.local
18+
.env.production.local
19+
20+
npm-debug.log*
21+
yarn-debug.log*
22+
yarn-error.log*

LICENSE.MD

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

README.md

+31-18
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,42 @@
11
# react-counter
22

3-
A dead-simple incremental counter component with easing animations.
3+
>
44
5-
npm install @beanloop-ab/react-counter
5+
[![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)
66

7-
```js
8-
var React = require('react');
9-
var Counter = require('react-counter');
7+
## Install
108

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

1713
## Usage
1814

19-
```js
20-
<Counter
21-
begin={Number} // The number to count from
22-
end={Number} // The number to count to
23-
time={Number} // The time (in ms) the counting animation should take
24-
easing={String} // Which easing function to use (default="outCube")
25-
/>
15+
```tsx
16+
import * as React from 'react'
17+
18+
import {Counter} from 'react-counter'
19+
20+
class Example extends React.Component {
21+
render() {
22+
return (
23+
<div>
24+
<Counter from={500} to={1600} duration={2000} />
25+
<Counter to={1000} duration={2000} easing={n => n * n} />
26+
<Counter to={1000} duration={2000} easing={n => n} />
27+
<Counter to={1000}>
28+
{value => (
29+
<p style={{color: 'red'}}>
30+
{value} custom formatting with render prop
31+
</p>
32+
)}
33+
</Counter>
34+
</div>
35+
)
36+
}
37+
}
2638
```
2739

28-
The `easing` property, can be a name of any easing function from
29-
[ease-component](https://www.npmjs.com/package/ease-component)
40+
## License
41+
42+
MIT © [Beanloop](https://github.com/beanloop-ab), [Jakob Miland](https://github.com/saebekassebil)

0 commit comments

Comments
 (0)