-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpage.js
121 lines (99 loc) · 2.01 KB
/
page.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import { style, color, routes, font, device } from './constants'
view Page {
prop base, children, sidebar
<Contain>
<Page.Sidebar if={base} yield />
<sidebar if={sidebar}>{sidebar}</sidebar>
<inner>
{children}
</inner>
</Contain>
<Footer />
$ = {
fontSize: 18,
lineHeight: '1.95rem',
padding: [20, 0, 0],
flexGrow: 1,
[device.small]: {
flexFlow: 'column'
}
}
$Contain = {
margin: 'auto',
flexFlow: 'row',
[device.small]: {
flexFlow: 'column'
}
}
$inner = {
padding: [5, 110, 100, 60],
width: '100%'
}
}
view Page.Sidebar {
<links if={view.props.list}>
<Page.Link base={view.props.base} repeat={view.props.list} {..._} />
</links>
<content if={!view.props.list} yield />
$ = {
width: 120,
margin: [20, 10],
right: 20,
userSelect: 'none',
[device.small]: {
borderRight: 'none',
flexFlow: 'row',
width: '90%',
flexWrap: 'wrap',
justifyContent: 'center',
}
}
}
view Page.Link {
const url = slug => view.props.base + '/' + slug
<a
class={{ active: Motion.router.isActive(url(view.props.slug)) }}
onClick={Motion.router.link(url(view.props.slug))}>
{view.props.title}
</a>
$a = {
borderRight: [3, 'solid', 'transparent'],
color: '#555',
fontSize: 16,
whiteSpace: 'nowrap',
padding: [0, 13],
margin: 0,
minWidth: 130,
display: 'flex',
width: '100%',
textAlign: 'right',
cursor: 'pointer',
hover: {
color: color.brand1
},
[device.small]: {
width: 'auto'
}
}
$active = {
fontWeight: 600,
color: '#444',
borderColor: color.brand,
[device.small]: {
border: 'none',
textAlign: 'center',
width: 'auto'
}
}
}
view RoutedContent {
prop parent, content, params
let el
on.props(() => {
el = content.filter(item => item.slug == params.slug)[0]
})
<body>
{view.el(`${parent}.${el.view}`)}
</body>
$body = { width: '100%' }
}