forked from gatsbyjs/gatsby
/
navigation-mobile.js
62 lines (58 loc) 路 1.74 KB
/
navigation-mobile.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
import React from "react"
import { Link } from "gatsby"
import {
BlogIcon,
DocsIcon,
TutorialIcon,
PluginsIcon,
ShowcaseIcon,
} from "../assets/mobile-nav-icons"
import presets, { colors } from "../utils/presets"
import typography, { rhythm, scale, options } from "../utils/typography"
const MobileNavItem = ({ linkTo, label, icon }) => (
<Link
to={linkTo}
css={{
color: colors.gatsby,
fontSize: scale(-1 / 2).fontSize,
letterSpacing: `0.0075rem`,
lineHeight: 1,
padding: `${rhythm(options.blockMarginBottom / 4)} ${rhythm(
options.blockMarginBottom
)} ${rhythm(options.blockMarginBottom / 2)} `,
textDecoration: `none`,
textAlign: `center`,
}}
>
<img src={icon} css={{ height: 32, display: `block`, margin: `0 auto` }} alt={`${label} Icon`} />
<div>{label}</div>
</Link>
)
const MobileNavigation = () => (
<div
css={{
position: `fixed`,
display: `flex`,
justifyContent: `space-around`,
alignItems: `center`,
bottom: 0,
left: 0,
right: 0,
zIndex: 1,
borderTop: `1px solid ${colors.ui.light}`,
background: colors.ui.whisper,
fontFamily: typography.options.headerFontFamily.join(`,`),
paddingBottom: `env(safe-area-inset-bottom)`,
[presets.Tablet]: {
display: `none`,
},
}}
>
<MobileNavItem linkTo="/docs/" label="Docs" icon={DocsIcon} />
<MobileNavItem linkTo="/tutorial/" label="Tutorial" icon={TutorialIcon} />
<MobileNavItem linkTo="/plugins/" label="Plugins" icon={PluginsIcon} />
<MobileNavItem linkTo="/blog/" label="Blog" icon={BlogIcon} />
<MobileNavItem linkTo="/showcase/" label="Showcase" icon={ShowcaseIcon} />
</div>
)
export default MobileNavigation