Skip to content

Commit cc97096

Browse files
authored
Merge pull request #30 from xendora/readme-update-3
chore: updated readme
2 parents fec0b7d + 19a0e33 commit cc97096

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# react-timer
22
> A minimalistic yet customizable timer component!
33
4+
45
[Live demo](https://xendora.github.io/react-timer/examples)
56

6-
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
7+
![Travis (.org) branch](https://img.shields.io/travis/xendora/react-timer/master?style=for-the-badge) ![GitHub Release Date](https://img.shields.io/github/release-date/xendora/react-timer?style=for-the-badge) ![npm](https://img.shields.io/npm/v/@xendora/react-timer?style=for-the-badge) ![NPM](https://img.shields.io/npm/l/@xendora/react-timer?style=for-the-badge)
8+
![npm bundle size](https://img.shields.io/bundlephobia/min/@xendora/react-timer?style=for-the-badge) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@xendora/react-timer?style=for-the-badge)
79

810
![Basic Timer with 100ms interval](docs/images/incremental-counter.gif "Basic Timer with 100ms interval")
911

@@ -20,6 +22,41 @@ npm install @xendora/react-timer
2022
yarn add @xendora/react-timer
2123
```
2224

25+
### Usage
26+
```js
27+
import ReactTimer from "@xendora/react-timer";
28+
29+
// Incremental counter
30+
<ReactTimer
31+
interval={100}
32+
start={0}
33+
end={t => t === 100}
34+
onTick={t => t + 1}
35+
>
36+
{time => <span>{time}</span>}
37+
</ReactTimer>
38+
39+
// Decremetal counter
40+
<ReactTimer
41+
interval={100}
42+
start={100}
43+
end={t => t === 0}
44+
onTick={t => t - 1}
45+
>
46+
{time => <span>{time}</span>}
47+
</ReactTimer>
48+
49+
// Infinite counter
50+
<ReactTimer
51+
interval={100}
52+
start={0}
53+
end={t => false}
54+
onTick={t => t + 1}
55+
>
56+
{time => <span>{time}</span>}
57+
</ReactTimer>
58+
```
59+
2360
## Props
2461
| Name | Type | Description |
2562
| ------------- | ------------- | ------------- |
@@ -33,4 +70,4 @@ yarn add @xendora/react-timer
3370

3471
## License
3572

36-
MIT © [xendora](https://github.com/xendora)
73+
MIT © [xendora](https://github.com/xendora)

0 commit comments

Comments
 (0)