/
index.js
115 lines (107 loc) 路 3.12 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
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
'use strict';
import styles from './styles.module.css';
import Link from '@docusaurus/Link';
import useBaseUrl from '@docusaurus/useBaseUrl';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout';
import classnames from 'classnames';
import GitHubButton from 'react-github-btn';
import React from 'react';
const contents = [
{
content:
'Metro aims for sub-second reload cycles, fast startup and quick bundling speeds.',
image: '/metro/img/content/high-speed-train.png',
title: 'Fast',
},
{
content: 'Works with thousands of modules in a single application.',
image: '/metro/img/content/scales.png',
title: 'Scalable',
},
{
content: 'Supports every React Native project out of the box.',
image: '/metro/img/content/atom.png',
title: 'Integrated',
},
];
const Button = ({children, href}) => {
return (
<div className="col col--2 margin-horiz--sm">
<Link
className="button button--outline button--primary button--lg"
to={href}>
{children}
</Link>
</div>
);
};
const HomeSplash = () => {
const context = useDocusaurusContext();
const {siteConfig = {}} = context;
return (
<div className={classnames('hero hero-dark', styles.heroBanner)}>
<div className="container">
<img
className={classnames(styles.heroBannerLogo, 'margin-vert--md')}
src={'./img/metro.svg'}
alt="Metro"
/>
<h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<div
className={classnames(styles.heroButtons, 'name', 'margin-vert--md')}>
<Button href={useBaseUrl('docs/getting-started')}>Get Started</Button>
<Button href={useBaseUrl('docs/api')}>Learn More</Button>
</div>
<GitHubButton
href="https://github.com/facebook/metro"
data-icon="octicon-star"
data-size="large"
data-show-count="true"
aria-label="Star facebook/metro on GitHub">
Star
</GitHubButton>
</div>
</div>
);
};
const Index = () => {
return (
<Layout title="Metro">
<HomeSplash />
<div className="container">
<div class="row">
{contents.map(({content, title, image}) => {
return (
<div className="col col--4 margin-vert--md">
<div
className={classnames(
styles.blockContainer,
'padding-horiz--md',
)}>
<img
src={image}
className={classnames(styles.blockImage)}
alt=""
/>
<h2>{title}</h2>
<p>{content}</p>
</div>
</div>
);
})}
</div>
</div>
</Layout>
);
};
export default Index;