-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathNav.tsx
77 lines (66 loc) · 1.52 KB
/
Nav.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import * as React from 'react';
import styled from '@emotion/styled';
import { Tabs } from 'antd';
import { useRouter } from 'next/router';
import pkg from '../package.json';
import { GithubFilled } from '@ant-design/icons';
interface Props {}
function Nav(_props: Props) {
const router = useRouter();
return (
<Container>
<Header>
<h1>{pkg.name}</h1>
<Version>{pkg.version}</Version>
<GithubFilled style={{ fontSize: 20 }} onClick={() => window.open(pkg.repository)} />
</Header>
<Tabs
animated={false}
defaultActiveKey={router.asPath}
items={[
{ label: `Basic`, key: '/' },
{ label: `CustomizeStyle`, key: '/customizeStyle' },
{ label: `DisableOnBlurValidation`, key: '/disableOnBlurValidation' },
{ label: `AsyncValidate`, key: '/asyncValidate' },
]}
onTabClick={async activeKey => {
await router.push(activeKey);
}}
/>
</Container>
);
}
const Container = styled.div`
ul {
padding-left: 0;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
gap: 10px;
li {
list-style: none;
}
a {
&:hover {
color: #3b82f6;
}
}
}
`;
const Header = styled.div`
display: flex;
flex-direction: row;
align-items: center;
gap: 10px;
h1 {
margin: 0;
}
`;
const Version = styled.div`
padding: 1px 5px;
background-color: #000;
color: #fff;
border-radius: 4px;
`;
export default Nav;