-
Notifications
You must be signed in to change notification settings - Fork 26
/
index.tsx
63 lines (57 loc) · 1.29 KB
/
index.tsx
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
import React from 'react';
import styled from 'styled-components';
import { StaticQuery, graphql } from 'gatsby';
import { rem } from '@heathmont/moon-utils';
import { PagesData } from '../../types';
import { transformSections } from './transform';
import { Logo } from './logo';
import { Menu, MenuList } from './menu';
const sidebar = graphql`
query {
pages: allMdx {
edges {
node {
frontmatter {
name
menu
route
}
}
}
}
config: allDocsJson {
edges {
node {
menuSections
}
}
}
}
`;
const NavContainer = styled.nav(({ theme: { space, color } }) => ({
paddingTop: rem(24),
paddingBottom: rem(24),
paddingLeft: rem(32),
paddingRight: rem(32),
backgroundColor: color.gohan[100],
minWidth: rem(272),
}));
const NavContainerWrapper = styled.div({
padding: rem(32),
});
export const Nav = () => (
<StaticQuery
query={sidebar}
render={(data: PagesData) => (
<NavContainer>
<NavContainerWrapper>
<Logo />
<MenuList>
{/* TODO: Investigate IDE type issue highlighting */}
<Menu items={transformSections(data)} />
</MenuList>
</NavContainerWrapper>
</NavContainer>
)}
/>
);