mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 17:15:48 +00:00
js styles replaced with css modules for performance
This commit is contained in:
parent
c55c0b7ba9
commit
63893f5690
3 changed files with 9 additions and 10 deletions
|
|
@ -4,18 +4,19 @@ import styles from './styles';
|
|||
|
||||
class Checkbox extends Component {
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
return nextProps.checked !== this.props.checked;
|
||||
return nextProps.checked !== this.props.checked ||
|
||||
nextProps.enabled !== this.props.enabled;
|
||||
}
|
||||
|
||||
onPress = () => {
|
||||
if (typeof this.props.onPress === 'function') {
|
||||
if (this.props.enabled && typeof this.props.onPress === 'function') {
|
||||
this.props.onPress();
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div style={styles.root} onClick={this.onPress} />
|
||||
<div className={styles.root} onClick={this.onPress} />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
5
src/common/checkbox/styles.css
Normal file
5
src/common/checkbox/styles.css
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.root {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background-color: red;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
export default {
|
||||
root: {
|
||||
width: 300,
|
||||
height: 300,
|
||||
backgroundColor: 'red'
|
||||
},
|
||||
};
|
||||
Loading…
Reference in a new issue