Skip to content
This repository was archived by the owner on Aug 19, 2022. It is now read-only.

Commit 492ece8

Browse files
author
Brandon Dail
committed
Add linting to demo, fix style issues
1 parent a8e9608 commit 492ece8

File tree

7 files changed

+100
-83
lines changed

7 files changed

+100
-83
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
"browser": true,
55
"es6": true,
66
"node": true,
7-
"jest": true
7+
"jest": true,
88
},
99
"extends": [
1010
"eslint:recommended",

demo/.eslintrc.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"es6": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:react/recommended"
9+
],
10+
"parserOptions": {
11+
"ecmaFeatures": {
12+
"experimentalObjectRestSpread": true,
13+
"jsx": true
14+
},
15+
"sourceType": "module"
16+
},
17+
"plugins": [
18+
"react"
19+
],
20+
"rules": {
21+
"indent": [
22+
"error",
23+
2
24+
],
25+
"linebreak-style": [
26+
"error",
27+
"unix"
28+
],
29+
"quotes": [
30+
"error",
31+
"single"
32+
],
33+
"semi": [
34+
"error",
35+
"always"
36+
]
37+
}
38+
};

demo/app.js

Lines changed: 47 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import React from "react";
2-
import ReactDOM from "react-dom";
3-
import Radium, { Style, StyleRoot } from "radium";
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import Radium, { Style, StyleRoot } from 'radium';
44
import * as animations from '../lib';
5-
import merge from '../lib/merge';
65

76
import Demo from './demo';
87

@@ -11,49 +10,47 @@ const styles = {
1110
textAlign: 'center',
1211
paddingTop: 200,
1312
body: {
14-
backgroundColor: 'white',
15-
color: 'white',
16-
fontFamily: "Whitney SSm A, Whitney SSm B, Helvetica Neue, Helvetica, Arial, sans-serif",
13+
backgroundColor: '#e7e5e3',
14+
fontFamily: 'Whitney SSm A, Whitney SSm B, Helvetica Neue, Helvetica, Arial, sans-serif',
1715
lineHeight: 1.5,
1816
margin: 0,
1917
transform: 'translate3d(0, 0, 0)',
20-
},
21-
p: {
22-
margin: 0,
23-
color: '#242121'
24-
},
25-
select: {
26-
backgroundColor: '#e7e5e3',
27-
border: 'none',
28-
height: 35,
29-
fontSize: 15,
30-
fontFamily: 'inherit',
31-
width: 155,
32-
fontWeight: 'bold',
33-
},
34-
input: {
35-
backgroundColor: '#e7e5e3',
36-
height: 35,
37-
border: 'none',
38-
padding: '0px 5px',
39-
borderRadius: 6,
40-
fontFamily: 'inherit'
41-
},
42-
button: {
43-
backgroundColor: '#e7e5e3',
44-
outline: 'none',
45-
backgroundColor: 'white',
46-
height: 35,
47-
border: 'none',
48-
padding: '0px 10px',
49-
borderRadius: 6,
50-
fontFamily: 'inherit'
51-
},
52-
label: {
53-
position: 'absolute',
54-
bottom: 0,
55-
fontSize: 10,
56-
},
18+
},
19+
p: {
20+
margin: 0,
21+
color: '#242121'
22+
},
23+
select: {
24+
border: 'none',
25+
height: 35,
26+
fontSize: 15,
27+
fontFamily: 'inherit',
28+
width: 155,
29+
fontWeight: 'bold',
30+
},
31+
input: {
32+
height: 35,
33+
width: 50,
34+
border: 'none',
35+
padding: '0px 5px',
36+
borderRadius: 6,
37+
fontFamily: 'inherit'
38+
},
39+
button: {
40+
backgroundColor: 'white',
41+
outline: 'none',
42+
height: 35,
43+
border: 'none',
44+
padding: '0px 10px',
45+
borderRadius: 6,
46+
fontFamily: 'inherit'
47+
},
48+
label: {
49+
color: '#242121',
50+
position: 'absolute',
51+
bottom: 0,
52+
fontSize: 10,
53+
},
5754
},
5855
container: {
5956
position: 'relative',
@@ -95,7 +92,7 @@ class App extends React.Component {
9592
this.state = {
9693
animation: 'bounce',
9794
library: 'Radium',
98-
}
95+
};
9996
this.duration = 1;
10097
this.selectAnimation = this.selectAnimation.bind(this);
10198
this.onDurationChange = this.onDurationChange.bind(this);
@@ -115,13 +112,12 @@ class App extends React.Component {
115112
triggerAnimation() {
116113
const { animation } = this.state;
117114
this.setState({ animation: '' }, () => {
118-
this.setState({ animation })
119-
})
115+
this.setState({ animation });
116+
});
120117
}
121118

122119
render() {
123120
const { animation } = this.state;
124-
console.log('render')
125121
return (
126122
<StyleRoot>
127123
<div style={styles.global}>
@@ -149,7 +145,7 @@ class App extends React.Component {
149145
Duration
150146
</label>
151147
<input
152-
value={this.state.duration}
148+
defaultValue='1'
153149
onChange={this.onDurationChange}
154150
id='duration'
155151
style={styles.duration}
@@ -164,10 +160,10 @@ class App extends React.Component {
164160
</div>
165161
</div>
166162
</StyleRoot>
167-
)
163+
);
168164
}
169165
}
170166

171167
const Wrapper = Radium(App);
172168

173-
ReactDOM.render(<Wrapper/>, document.getElementById("content"));
169+
ReactDOM.render(<Wrapper/>, document.getElementById('content'));

demo/controls.js

Whitespace-only changes.

demo/demo.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import React from "react";
2-
import ReactDOM from "react-dom";
3-
import Radium, { Style } from "radium";
1+
import React from 'react';
2+
import Radium from 'radium';
43

54

65
const Demo = ({ styles, duration, animation }) => {
76
const headerStyle = {
87
...(styles[animation]),
98
animationDuration: `${duration}s`,
10-
width: 500,
9+
width: 600,
1110
fontSize: 60,
1211
margin: '30px auto',
1312
color: '#c43a31'
@@ -16,7 +15,8 @@ const Demo = ({ styles, duration, animation }) => {
1615
...styles.fadeInUp,
1716
animationDuration: '2s',
1817
fontSize: 16,
19-
}
18+
marginBottom: 25,
19+
};
2020

2121
// Render a bunch of empty spans so that each keyframe
2222
// will be available in the DOM.
@@ -31,7 +31,13 @@ const Demo = ({ styles, duration, animation }) => {
3131
<p style={descriptionStyle}>A collection of animations for CSS-in-JS libraries </p>
3232
<a href='https://github.com/FormidableLabs/react-animations'>View on Github</a>
3333
</div>
34-
)
35-
}
34+
);
35+
};
36+
37+
Demo.propTypes = {
38+
styles: React.PropTypes.object,
39+
duration: React.PropTypes.number,
40+
animation: React.PropTypes.string,
41+
};
3642

3743
export default Radium(Demo);

demo/radium.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"babel-preset-react": "^6.11.1",
3838
"eslint": "^3.6.0",
3939
"eslint-plugin-flowtype": "^2.19.0",
40+
"eslint-plugin-react": "^6.3.0",
4041
"flow-bin": "^0.32.0",
4142
"jest": "^15.1.1",
4243
"jest-cli": "^15.1.1",

0 commit comments

Comments
 (0)