-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.js
59 lines (50 loc) · 1.49 KB
/
index.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
53
54
55
56
57
58
59
import React from 'react'
import { render } from 'react-dom'
// import the design-system
import ds from './myDesignSystem'
// We can use styled-components or glamorous
import glamorous from 'glamorous'
import styled from 'react-emotion'
// Create some components
const EmotionHeading = styled('h2')`
color: ${ds.color('dark')};
font-size: ${ds.fontSize('l')};
font-family: ${ds.get('type.fontFamily.system')};
`
const EmotionButton = styled('button')`
background-color: ${ds.color('secondary')};
border: 0;
border-radius: ${ds.get('borderRadius')};
padding: ${ds.get('spacing.padding')};
color: ${ds.color('bright')};
font-size: ${ds.fontSize('l')};
&:hover {
background-color: ${ds.color('secondary', 'dark')};
}
`
const GlamorousHeading = glamorous.h2({
color: ds.color('dark'),
fontSize: ds.fontSize('l'),
fontFamily: ds.get('type.fontFamily.system'),
})
const GlamorousButton = glamorous.button({
backgroundColor: ds.color('primary'),
border: 0,
borderRadius: ds.get('borderRadius'),
padding: ds.get('spacing.padding'),
color: ds.color('bright'),
fontSize: ds.fontSize('l'),
':hover': {
backgroundColor: ds.color('primary', 'light'),
},
})
const App = () => (
<div>
<EmotionHeading>With Styled Components</EmotionHeading>
<EmotionButton>Please click me</EmotionButton>
<br />
<GlamorousHeading>With Glamorous</GlamorousHeading>
<GlamorousButton>Please click me</GlamorousButton>
</div>
)
render(<App />, document.getElementById('root'))