-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
239 lines (220 loc) · 5.77 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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
import React from 'react'
import Link from 'gatsby-link'
import Helmet from 'react-helmet'
import Examples from '../pages/community/examples'
import Header from '../components/Header'
import Features from '../components/Features'
import Section from '../components/Section'
import { accent, gray } from '../utils/colors'
import logo from '../images/reason_300.png'
import { headerFontFamily } from '../utils/typography'
const features = [
{
title: 'Types without hassle',
description:
'Powerful, safe type inference means you rarely have to annotate types, but everything gets checked for you.',
action: 'Learn about types',
url: '/guide/language/type/',
},
// {
// title: 'Web or Native', // 😢 not ready yet
// description: 'Write your frontend, backend, and build tools all in the same language -- without compromising on speed.',
// action: 'Native quickstart',
// url: '/guide/native/quickstart/',
// },
{
title: 'Easy JavaScript interop',
description:
"Use packages from NPM/Yarn with minimum hassle, or even drop in a snippet of raw JavaScript while you're learning!",
action: 'Learn about interop',
url: '/guide/javascript/interop/',
},
{
title: 'Flexible & Fun',
description:
'Make websites, animations, games, servers, cli tools, and more! Take a look at these examples to get inspired.',
action: 'See examples',
url: '/community/examples',
},
]
export default class Index extends React.Component {
render() {
const { mainExample, jsquickstart, examples } = this.props.data
return (
<div css={styles.container}>
<Helmet title={`Reason`} />
<Section backgroundColor={gray}>
<Header />
<div css={{ alignItems: 'center' }}>
<img src={logo} css={styles.logo} role="presentation"/>
<div css={styles.frontAndCenter}>
<div css={styles.mainExample}
dangerouslySetInnerHTML={{
__html: mainExample.childMarkdownRemark.html,
}}
/>
<p css={styles.description}>
Reason lets you write simple, fast and quality type safe code while leveraging both the JavaScript & OCaml ecosystems.
</p>
</div>
<div css={styles.buttonGroup}>
<Link to="/try" css={[styles.button, styles.actionButton]}>
Try online
</Link>
<Link to="/guide/what-and-why" css={styles.button}>
Learn more
</Link>
</div>
</div>
<div css={styles.features}>
<div css={[styles.content]}>
<div css={styles.featuresDivider} />
<Features features={features} />
</div>
</div>
</Section>
<Section css={[styles.quickstarts, styles.twoColumn]}>
<div css={styles.column}>
<h3 css={styles.columnHeader}>JavaScript Quick Start</h3>
<div
css={styles.jsquickstart}
dangerouslySetInnerHTML={{
__html: jsquickstart.childMarkdownRemark.html,
}}
/>
</div>
<div css={styles.column}>
<h3 css={styles.columnHeader}>Examples</h3>
<Examples />
</div>
</Section>
</div>
)
}
}
export const pageQuery = graphql`
query IndexQuery {
mainExample: file(relativePath: { eq: "index-example.md" }) {
childMarkdownRemark {
html
}
}
jsquickstart: file(relativePath: { eq: "guide/javascript/quickstart.md" }) {
childMarkdownRemark {
html
}
}
}
`
const styles = {
container: {},
inner: {},
header: {
backgroundColor: gray,
alignItems: 'center',
},
twoColumn: {
flexDirection: 'row',
'@media(max-width: 800px)': {
flexDirection: 'column',
},
},
column: {
flexGrow: 1,
flexBasis: 0,
flexShrink: 1,
margin: '0 20px',
minWidth: 0,
'@media(max-width: 800px)': {
flexBasis: 'auto',
},
},
columnHeader: {
alignSelf: 'center',
},
frontAndCenter: {
flexDirection: 'row',
alignItems: 'center',
margin: '2rem',
'@media(max-width: 950px)': {
flexDirection: 'column'
}
},
description: {
maxWidth: 600,
fontWeight: 200,
fontSize: '1.1em',
lineHeight: '1.5em',
textAlign: 'center',
textShadow: '0px 1px #f4f2f2',
padding: '0.8em',
marginBottom: 0,
fontFamily: headerFontFamily(),
'@media(min-width: 800px)': {
fontSize: '1.5em',
},
},
content: {
maxWidth: 1270,
alignSelf: 'center',
},
mainExample: {
'& .hljs': {
background: 'transparent',
border: 'none',
marginBottom: 0
}
},
button: {
fontFamily: headerFontFamily(),
textDecoration: 'none',
border: '1px solid currentColor',
padding: '8px 34px',
color: 'currentColor',
borderRadius: 5,
margin: 10,
textAlign: 'center',
},
actionButton: {
border: 'none',
background: accent,
color: 'white',
},
buttonGroup: {
flexDirection: 'row',
marginBottom: '3rem',
'@media(max-width: 340px)': {
flexDirection: 'column',
width: '80%',
},
},
featuresDivider: {
height: 1,
backgroundColor: '#d6d4d4',
},
features: {
// backgroundColor: '#d0d0d0',
backgroundColor: '#f6f4f4',
},
quickstarts: {
backgroundColor: 'white',
padding: 30,
},
// please keep in sync with guide.css's markdown-content selectors
jsquickstart: {
'& a': {
color: accent,
textDecoration: 'none',
},
'& a:hover': {
textDecoration: 'underline',
},
'& a:visited': {
color: '#b13c2e',
},
},
logo: {
maxWidth: 300,
width: '80%',
},
}