forked from webpack/webpack.js.org
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNavigation.jsx
82 lines (73 loc) · 2.41 KB
/
Navigation.jsx
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
// Import External Dependencies
import React from 'react';
import Banner from 'react-banner';
// Import Components
import Link from '../Link/Link';
import Logo from '../Logo/Logo';
import Dropdown from '../Dropdown/Dropdown';
// Import helpers
import isClient from '../../utilities/is-client';
// Load Styling
import 'docsearch.js/dist/cdn/docsearch.css';
import './Navigation.scss';
import './Search.scss';
import GithubIcon from '../../styles/icons/github.svg';
import TwitterIcon from '../../styles/icons/twitter.svg';
import StackOverflowIcon from '../../styles/icons/stack-overflow.svg';
const onSearch = () => {};
export default class Navigation extends React.Component {
render() {
let { pathname, links, toggleSidebar } = this.props;
return (
<Banner
onSearch={onSearch}
blockName="navigation"
logo={ <Logo light={ true } /> }
url={ pathname }
items={[
...links,
{
title: 'GitHub Repository',
url: 'https://github.com/webpack/webpack',
className: 'navigation__item--icon',
content: <GithubIcon aria-hidden="true" fill="#fff" width={16} />
},
{
title: 'webpack on Twitter',
url: 'https://twitter.com/webpack',
className: 'navigation__item--icon',
content: <TwitterIcon aria-hidden="true" fill="#fff" width={16} />
},
{
title: 'webpack on Stack Overflow',
url: 'https://stackoverflow.com/questions/tagged/webpack',
className: 'navigation__item--icon',
content: <StackOverflowIcon aria-hidden="true" fill="#fff" width={16} />
},
{
className: 'navigation__item--icon',
content: (
<Dropdown
className="navigation__languages"
items={[
{ title: 'English', url: 'https://webpack.js.org/' },
{ lang: 'zh', title: '中文', url: 'https://webpack.docschina.org/' }
]} />
)
}
]}
link={ Link }
onMenuClick={ toggleSidebar } />
);
}
componentDidMount() {
if (isClient) {
const DocSearch = require('docsearch.js');
DocSearch({
apiKey: 'fac401d1a5f68bc41f01fb6261661490',
indexName: 'webpack-js-org',
inputSelector: '.navigation-search__input'
});
}
}
}