-
Notifications
You must be signed in to change notification settings - Fork 32
/
module_react.html
70 lines (64 loc) · 2 KB
/
module_react.html
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive HTML Example - Custom Button</title>
<!-- Material-UI CDN links -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<script nomodule src="https://unpkg.com/react@17.0.2/umd/react.development.js"></script>
<script nomodule src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js"></script>
<script nomodule src="https://unpkg.com/@material-ui/core@4.12.1/umd/material-ui.development.js"></script>
<style>
.custom-button {
border-radius: 3px;
border: none;
color: white;
margin: 0 20px;
}
.custom-button-primary {
background: linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%);
}
.custom-button-secondary {
background: linear-gradient(45deg, #2196f3 30%, #21cbf3 90%);
}
</style>
</head>
<body>
<h1>Interactive HTML Example - Custom Button</h1>
<div id="root"></div>
<script>
const { Button } = MaterialUI;
const style = {
root: {
borderRadius: 3,
border: 0,
color: "white",
margin: "0 20px"
},
primary: {
background: "linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)"
},
secondary: {
background: "linear-gradient(45deg, #2196f3 30%, #21cbf3 90%)"
}
};
function CustomButton(props) {
return (
<Button {...props} style={{ ...style.root, ...style[props.color] }}>
{props.children}
</Button>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(
<div>
<CustomButton color="primary">Primary Button</CustomButton>
<CustomButton color="secondary">Secondary Button</CustomButton>
</div>,
rootElement
);
</script>
</body>
</html>