-
Notifications
You must be signed in to change notification settings - Fork 285
/
Copy pathbutton.js
52 lines (42 loc) · 819 Bytes
/
button.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React, { Component } from 'react';
import { render } from 'react-dom';
import css from 'css-constructor';
class Container extends Component {
@css`
text-align: center;
`;
render() {
return <div>{this.props.children}</div>;
}
}
class Button extends Component {
@css`
background-color: #ff0000;
width: 320px;
padding: 20px;
border-radius: 5px;
border: none;
outline: none;
&:hover {
color: #fff;
}
&:active {
position: relative;
top: 2px;
}
@media (max-width: 480px) {
& {
width: 160px;
}
}
`;
render() {
return <button>{this.props.children}</button>;
}
}
const App = () => (
<Container>
<Button>Click me!</Button>
</Container>
);
render(<App />, document.getElementById('content'));