Skip to content

Commit cd40022

Browse files
authored
v2.2.0: "react-countdown" npm 📦 migration (#67)
* Initial commit for npm pkg migration with legacy countdown support * Update version number for minor release * Small refactorings and test updates * Fix test * Some more refactorings * Update keywords * Update examples * Fix examples build
1 parent 7edc709 commit cd40022

File tree

11 files changed

+3351
-2830
lines changed

11 files changed

+3351
-2830
lines changed

‎.travis.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ jobs:
1919
- stage: 'Build'
2020
name: 'Package'
2121
script: yarn build
22-
- script: cd ./examples && yarn && yarn build
22+
- script: rm -rf ./node_modules && cd ./examples && yarn && yarn build
2323
name: 'Examples'

‎README.md‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ A customizable countdown component for React.
1414
You can either install the module via `npm` or `yarn`:
1515

1616
```
17-
npm install react-countdown-now --save
17+
npm install react-countdown --save
1818
```
1919

2020
```
21-
yarn add react-countdown-now
21+
yarn add react-countdown
2222
```
2323

2424
## Motivation
@@ -34,14 +34,14 @@ A very simple and minimal example of how to set up a countdown which counts down
3434
```js
3535
import React from 'react';
3636
import ReactDOM from 'react-dom';
37-
import Countdown from 'react-countdown-now';
37+
import Countdown from 'react-countdown';
3838

3939
ReactDOM.render(
4040
<Countdown date={Date.now() + 10000} />,
4141
document.getElementById('root')
4242
);
4343
```
44-
[Live Demo](https://codesandbox.io/s/silent-forest-orfbe)
44+
[Live Demo](https://codesandbox.io/s/cool-fermat-uk0dq)
4545

4646
### Custom & Conditional Rendering
4747
In case you want to change the output of the component, or want to signal that the countdown's work is done, you can do this by either using the [`onComplete`](#oncomplete) callback, a
@@ -52,7 +52,7 @@ custom [`renderer`](#renderer), or by specifying a React child within `<Countdow
5252
```js
5353
import React from 'react';
5454
import ReactDOM from 'react-dom';
55-
import Countdown from 'react-countdown-now';
55+
import Countdown from 'react-countdown';
5656

5757
// Random component
5858
const Completionist = () => <span>You are good to go!</span>;
@@ -66,14 +66,14 @@ ReactDOM.render(
6666
document.getElementById('root')
6767
);
6868
```
69-
[Live Demo](https://codesandbox.io/s/sweet-villani-gvrm9)
69+
[Live Demo](https://codesandbox.io/s/condescending-bartik-kyp2v)
7070

7171
#### Custom Renderer with Completed Condition
7272

7373
```js
7474
import React from 'react';
7575
import ReactDOM from 'react-dom';
76-
import Countdown from 'react-countdown-now';
76+
import Countdown from 'react-countdown';
7777

7878
// Random component
7979
const Completionist = () => <span>You are good to go!</span>;
@@ -97,15 +97,15 @@ ReactDOM.render(
9797
document.getElementById('root')
9898
);
9999
```
100-
[Live Demo](https://codesandbox.io/s/infallible-zhukovsky-ydfrf)
100+
[Live Demo](https://codesandbox.io/s/sad-zhukovsky-hs7hc)
101101

102102
### Countdown in Milliseconds
103103
Here is an example with a countdown of 10 seconds that displays the total time difference in milliseconds. In order to display the milliseconds appropriately, the [`intervalDelay`](#intervaldelay) value needs to be lower than `1000`ms and a [`precision`](#precision) of `1` to `3` should be used. Last but not least, a simple [`renderer`](#renderer) callback needs to be set up.
104104

105105
```js
106106
import React from 'react';
107107
import ReactDOM from 'react-dom';
108-
import Countdown from 'react-countdown-now';
108+
import Countdown from 'react-countdown';
109109

110110
ReactDOM.render(
111111
<Countdown
@@ -117,7 +117,7 @@ ReactDOM.render(
117117
document.getElementById('root')
118118
);
119119
```
120-
[Live Demo](https://codesandbox.io/s/affectionate-sunset-2677h)
120+
[Live Demo](https://codesandbox.io/s/elastic-euclid-6vnlw)
121121

122122
## Props
123123

@@ -235,7 +235,7 @@ Returns a `boolean` for whether the countdown has been completed or not.
235235
This module also exports 3 simple helper functions which can be utilized to build your own countdown custom [`renderer`](#renderer).
236236

237237
```js
238-
import Countdown, { zeroPad, calcTimeDelta, formatTimeDelta } from 'react-countdown-now';
238+
import Countdown, { zeroPad, calcTimeDelta, formatTimeDelta } from 'react-countdown';
239239
```
240240

241241
### `zeroPad(value, [length = 2])`
@@ -298,5 +298,5 @@ The `options` object consists of the following three component props and is used
298298

299299
MIT
300300

301-
[npm]: https://img.shields.io/npm/v/react-countdown-now.svg
302-
[npm-url]: https://npmjs.com/package/react-countdown-now
301+
[npm]: https://img.shields.io/npm/v/react-countdown.svg
302+
[npm-url]: https://npmjs.com/package/react-countdown

‎examples/package.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
],
1717
"dependencies": {
1818
"@types/react": "^16.8.15",
19-
"@types/react-dom": "16.8.4",
19+
"@types/react-dom": "16.9.4",
2020
"react": "^16.8.6",
21-
"react-countdown-now": "^2.1.2",
21+
"react-countdown": "^2.2.0",
2222
"react-dom": "^16.8.6",
23-
"react-scripts": "3.0.0",
24-
"typescript": "3.4.5"
23+
"react-scripts": "3.3.0",
24+
"typescript": "3.7.4"
2525
}
2626
}

‎examples/src/ControlledCountdown.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22

3-
import Countdown from 'react-countdown-now';
3+
import Countdown from 'react-countdown';
44

55
interface ControlledCountdownState {
66
readonly date: number;

‎examples/src/CountdownApi.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22

3-
import Countdown, { CountdownApi } from 'react-countdown-now';
3+
import Countdown, { CountdownApi } from 'react-countdown';
44

55
export default class CountdownApiExample extends Component {
66
countdownApi: CountdownApi | null = null;

‎examples/src/index.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { Component } from 'react';
22
import ReactDOM from 'react-dom';
33

4-
import Countdown, { CountdownRenderProps } from 'react-countdown-now';
4+
import Countdown, { CountdownRenderProps } from 'react-countdown';
55
import ControlledCountdown from './ControlledCountdown';
66
import CountdownApi from './CountdownApi';
77

0 commit comments

Comments
 (0)