-
Notifications
You must be signed in to change notification settings - Fork 344
/
Copy pathwith-doc.js
151 lines (136 loc) · 3.64 KB
/
with-doc.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// Components
import Head from '../components/head'
import Header from '../components/header'
import Heading from '../components/heading'
import Page from '../components/page'
import { PDIV, P, Quote } from '../components/text/paragraph'
import { UL, LI } from '../components/text/list'
import { H3, H4 } from '../components/text/heading'
import { InlineCode } from '../components/text/code'
import { ExternalLink } from '../components/text/link'
import DocsNavbarDesktop from '../components/docs/navbar/desktop'
import DocsNavbarMobile from '../components/docs/navbar/mobile'
import FreezePageScroll from '../components/freeze-page-scroll'
export default function withDoc(options) {
return function withContent(content) {
const DocPage = props => (
<Page>
<Head titlePrefix="" title={`${options.title} - ZEIT Documentation`} />
<div className="header">
<Header
clean={true}
inverse={true}
user={props.user}
pathname={props.url.pathname}
onLogout={() => {
this.props.onUser(null)
this.props.url.push('/login')
}}
onLogoRightClick={() => props.url.push('/logos')}
/>
</div>
<FreezePageScroll>
<div className="sidebar">
<DocsNavbarDesktop url={props.url} />
</div>
</FreezePageScroll>
<div>
<div className="doc-layout">
<div className="topbar">
<DocsNavbarMobile url={props.url} />
</div>
<div className="content">
<h1>{options.title}</h1>
<div className="doc-markdown">
{content}
</div>
</div>
<div />
</div>
</div>
<style jsx>{`
.doc-layout {
display: flex;
margin: 100px 30px 50px 320px;
padding: 0 20px;
justify-content: left;
-webkit-font-smoothing: antialiased;
}
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
}
.sidebar {
position: fixed;
width: 280px;
margin-top: 0;
bottom: 0;
left: 0;
top: 100px;
padding-left: 30px;
overflow: auto;
-webkit-font-smoothing: antialiased;
}
.topbar {
display: none;
}
.content {
flex: 1;
max-width: 600px;
}
.content h1 {
color: #000;
font-size: 26px;
line-height: 20px;
font-weight: 400;
margin: 0 0 30px 0;
padding: 0;
}
@media screen and (max-width: 950px) {
.header {
position: relative;
}
.doc-layout {
display: block;
margin: 0;
}
.content {
width: 100%;
margin-left: 0;
}
.sidebar {
display: none;
}
.topbar {
display: block;
}
}
`}</style>
</Page>
)
return DocPage
}
}
const DocH2 = ({ children }) => (
<Heading lean={true} offsetTop={175}>
<H3>{children}</H3>
</Heading>
)
const DocH3 = ({ children }) => (
<Heading lean={true} offsetTop={175}>
<H4>{children}</H4>
</Heading>
)
export const components = {
p: PDIV,
strong: P.B,
ul: UL,
li: LI,
h2: DocH2,
h3: DocH3,
code: InlineCode,
a: ExternalLink,
blockquote: Quote
}