- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
a3f05ce
commit 695f0cb
Showing
15 changed files
with
350 additions
and
342 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["es2015", "stage-0", "react"] | ||
} |
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 @@ | ||
{ | ||
"extends": "standard", | ||
"parser": "babel-eslint", | ||
"env": { | ||
"mocha": true, | ||
"node": true | ||
}, | ||
"globals": { | ||
"expect": true | ||
}, | ||
"rules": { | ||
"no-unused-expressions": 0 | ||
} | ||
} |
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,6 +1,9 @@ | ||
# https://git-scm.com/docs/gitignore | ||
# https://help.github.com/articles/ignoring-files | ||
# Example .gitignore files: https://github.com/github/gitignore | ||
/bower_components/ | ||
/node_modules/ | ||
.DS_Store | ||
pids | ||
logs | ||
npm-debug.log | ||
node_modules | ||
example/lib | ||
example/app.bundle.js | ||
example/app.promise.bundle.js | ||
/lib | ||
coverage |
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,4 @@ | ||
language: node_js | ||
node_js: | ||
- "4" | ||
- "5" |
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,15 @@ | ||
BIN=node_modules/.bin | ||
|
||
build: | ||
$(BIN)/babel src --out-dir lib && \ | ||
$(BIN)/babel example/src --out-dir example/lib && \ | ||
$(BIN)/webpack example/lib/app.js example/app.bundle.js -p && \ | ||
$(BIN)/webpack example/lib/app.promise.js example/app.promise.bundle.js -p | ||
|
||
clean: | ||
rm -rf lib && rm -rf example/lib && rm -f example/app.bundle.js && rm -f example/app.promise.bundle.js | ||
|
||
lint: | ||
$(BIN)/eslint src && $(BIN)/eslint tests | ||
|
||
PHONY: build clean lint |
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 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
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,47 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import ProgressButton, {STATE} from '../../lib/index' | ||
|
||
const App = React.createClass({ | ||
getInitialState () { | ||
return { | ||
button1State: STATE.NOTHING, | ||
button2State: STATE.NOTHING | ||
} | ||
}, | ||
|
||
render () { | ||
return ( | ||
<div> | ||
<div id="button-success"> | ||
<ProgressButton state={this.state.button1State} onClick={this.handleClick1}> | ||
Go! | ||
</ProgressButton> | ||
</div> | ||
<div id="button-error"> | ||
<ProgressButton state={this.state.button2State} onClick={this.handleClick2}> | ||
Go! | ||
</ProgressButton> | ||
</div> | ||
</div> | ||
) | ||
}, | ||
|
||
handleClick1 () { | ||
this.setState({button1State: STATE.LOADING}) | ||
// make asynchronous call | ||
setTimeout(() => { | ||
this.setState({button1State: STATE.SUCCESS}) | ||
}, 3000) | ||
}, | ||
|
||
handleClick2 () { | ||
this.setState({button2State: STATE.LOADING}) | ||
// make asynchronous call | ||
setTimeout(() => { | ||
this.setState({button2State: STATE.ERROR}) | ||
}, 3000) | ||
} | ||
}) | ||
|
||
ReactDOM.render(<App />, document.getElementById('app')) |
Oops, something went wrong.