-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
163 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,66 @@ | ||
# flip-timer | ||
# react-flip-counter | ||
|
||
React flip counter. Docs in progress, checkout example https://jeka1985.github.io/ | ||
> React countdown timer, like an 80-s flip clocks | ||
May be useful for stuff like promos, sales, launch landings and so on. | ||
|
||
## Install | ||
``` | ||
npm i --save react-flip-counter | ||
``` | ||
|
||
## Webpack configuation | ||
|
||
As react-flip-counter contains JSX syntax and has CSS resources, | ||
it must be parsed with babel and CSS loader. | ||
|
||
You may have a list of such UI modules, so it might be useful | ||
create array with such types of modules names and use it as | ||
loader includes with main src folder | ||
|
||
``` | ||
var uiModules = ['react-flip-counter'], | ||
includes = uiModules.reduce((res, name) => { | ||
res.push(path.resolve(root, 'node_modules/' + name)); | ||
return res; | ||
}, [path.resolve(root, 'src/')]); | ||
``` | ||
|
||
Then you need to update loaders configuration | ||
and use include instead exclude property | ||
|
||
``` | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
include: includes, | ||
use: { | ||
loader: 'babel', | ||
... | ||
} | ||
}, | ||
{ | ||
test: /\.css$/, | ||
include: includes, | ||
use: { | ||
loader: 'css', | ||
... | ||
} | ||
} | ||
... | ||
] | ||
``` | ||
|
||
## Usage | ||
``` | ||
<Counter | ||
onStop={() => alert('stopped')} | ||
stop={new Date('Wed Nov 15 2017 15:57:38 GMT+0300 (MSK)')}/> | ||
``` | ||
|
||
## Props | ||
* `onStop` | ||
Function to be called on time over | ||
|
||
* `stop` | ||
Time when counter shod stop and show all zeros. expect Date |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,16 @@ | ||
{ | ||
"name": "box-kit", | ||
"version": "1.0.0", | ||
"description": "Webpack + React start kit", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "test", | ||
"build": "webpack --progress", | ||
"dev": "webpack-dev-server" | ||
}, | ||
"name": "react-flip-counter", | ||
"version": "0.4.0", | ||
"description": "React flip countdown timer", | ||
"main": "src/Countdown/index.js", | ||
"author": "Eugene Yemelin", | ||
"license": "ISC", | ||
"babel": { | ||
"presets": [ | ||
"es2015", | ||
"react" | ||
] | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.18.2", | ||
"babel-loader": "^6.2.7", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-preset-react": "^6.16.0", | ||
"css-loader": "^0.26.0", | ||
"extract-text-webpack-plugin": "^1.0.1", | ||
"node-sass": "^3.13.0", | ||
"postcss-loader": "^1.1.1", | ||
"sass-loader": "^4.0.2", | ||
"webpack": "^1.13.3", | ||
"webpack-dev-server": "^1.16.2" | ||
}, | ||
"dependencies": { | ||
"react": "^15.4.1", | ||
"react-dom": "^15.4.1" | ||
"classnames": "^2.2.5", | ||
"prop-types": "^15.6.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.1.0", | ||
"react-dom": "^16.1.0" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { bool, number } from 'prop-types'; | ||
|
||
export default { | ||
types: { | ||
reverse: bool, | ||
now: number, | ||
min: number, | ||
max: number | ||
}, | ||
|
||
defaults: { | ||
reverse: false, | ||
now: 0, | ||
min: 0, | ||
max: 9 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { instanceOf, func } from 'prop-types'; | ||
|
||
export default { | ||
|
||
types: { | ||
stop: instanceOf(Date), | ||
onStart: func, | ||
onStop: func | ||
}, | ||
|
||
defaults: { | ||
stop: new Date("Mon Nov 30 2020 00:00:00 GMT+0300 (MSK)") | ||
} | ||
}; |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.