-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathApp.jsx
More file actions
48 lines (38 loc) · 878 Bytes
/
App.jsx
File metadata and controls
48 lines (38 loc) · 878 Bytes
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
import React from 'react'
import type {StyledType} from '../types'
export default (styled: StyledType) => {
const App = styled('div')({
margin: 50,
})
const Header = styled('header')({
padding: 10,
})
// curried
const section = styled('section')
const Section = section({
color: 'red',
})
// composition
const AnotherSection = styled(Section)({
color: 'yellow',
})
const Title = styled('h1')({
color: 'red',
})
// function value
const Button = styled('button')({
margin: ({margin = 0}) => margin,
})
return () => (
<App>
<Header>
<Title>Title</Title>
</Header>
<Section data-name="content">
<Button>primitive test</Button>
<Button margin={10}>dynamic primitive test</Button>
</Section>
<AnotherSection>Another section</AnotherSection>
</App>
)
}