-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
chore(rebuild): finish navigation refactoring #2048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3642fd0
fix(icons): fix out of sync `viewbox` attributes on svgs
skipjack 027be8f
chore(navigation): migrate to `react-banner@next` and re-integrate ic…
skipjack 2ce2315
chore(navigation): re-incorporate docsearch and tweak menu position
skipjack d9fc15b
chore(navigation): include protocol in external links
skipjack 94dd928
chore(navigation): remove unused `import`
skipjack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,64 @@ | ||
// Import External Dependencies | ||
import React from 'react'; | ||
import Banner from 'react-banner'; | ||
import DocSearch from 'docsearch.js'; | ||
|
||
// Import Components | ||
import Link from '../Link/Link'; | ||
import Container from '../Container/Container'; | ||
import Logo from '../Logo/Logo'; | ||
import Dropdown from '../Dropdown/Dropdown'; | ||
|
||
// Load Styling | ||
import 'docsearch.js/dist/cdn/docsearch.css'; | ||
import './Navigation.scss'; | ||
import './Search.scss'; | ||
|
||
// TODO: Re-incorporate the icon links | ||
// <Link | ||
// className="navigation__icon" | ||
// title="GitHub Repository" | ||
// to="//github.com/webpack/webpack"> | ||
// <i className="sidecar__icon icon-github" /> | ||
// </Link> | ||
// <Link | ||
// className="navigation__icon" | ||
// title="See Questions on Stack Overflow" | ||
// to="//stackoverflow.com/questions/tagged/webpack"> | ||
// <i className="sidecar__icon icon-stack-overflow" /> | ||
// </Link> | ||
// <Dropdown | ||
// className="navigation__languages" | ||
// items={[ | ||
// { title: 'English', url: 'https://webpack.js.org/' }, | ||
// { title: '中文', url: 'https://doc.webpack-china.org/' } | ||
// ]} /> | ||
|
||
// TODO: Re-incorporate docsearch (see `react-banner` docs and `SearchResults` component/discussion) | ||
// componentDidMount() { | ||
// if (typeof window !== 'undefined') { | ||
// let docsearch = () => {}; | ||
|
||
// // XXX: hack around docsearch | ||
// if (window.docsearch) { | ||
// docsearch = window.docsearch.default || window.docsearch; | ||
// } | ||
|
||
// docsearch({ | ||
// apiKey: 'fac401d1a5f68bc41f01fb6261661490', | ||
// indexName: 'webpack-js-org', | ||
// inputSelector: '.navigation__search-input' | ||
// }); | ||
|
||
// window.addEventListener('keyup', e => { | ||
// if (e.which === 9 && e.target.classList.contains('navigation__search-input')) { | ||
// this._openSearch(); | ||
// } | ||
// }); | ||
// } | ||
// } | ||
|
||
export default class Navigation extends React.Component { | ||
render() { | ||
let { pathname, links, toggleSidebar } = this.props; | ||
|
||
return ( | ||
<Banner | ||
blockName="navigation" | ||
logo={ <Logo light={ true } /> } | ||
url={ pathname } | ||
links={ links } | ||
items={[ | ||
...links, | ||
{ | ||
title: 'GitHub Repository', | ||
url: 'https://github.com/webpack/webpack', | ||
className: 'navigation__item--icon', | ||
content: <i className="icon-github" /> | ||
}, | ||
{ | ||
title: 'Webpack on Stack Overflow', | ||
url: 'https://stackoverflow.com/questions/tagged/webpack', | ||
className: 'navigation__item--icon', | ||
content: <i className="icon-stack-overflow" /> | ||
}, | ||
{ | ||
className: 'navigation__item--icon', | ||
content: ( | ||
<Dropdown | ||
className="navigation__languages" | ||
items={[ | ||
{ title: 'English', url: 'https://webpack.js.org/' }, | ||
{ title: '中文', url: 'https://doc.webpack-china.org/' } | ||
]} /> | ||
) | ||
} | ||
]} | ||
link={ Link } | ||
onMenuClick={ toggleSidebar } /> | ||
); | ||
} | ||
|
||
componentDidMount() { | ||
DocSearch({ | ||
apiKey: 'fac401d1a5f68bc41f01fb6261661490', | ||
indexName: 'webpack-js-org', | ||
inputSelector: '.navigation-search__input' | ||
}); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to rethink how URLs are formed, when trying to build the site to work under a path I had to do a lot of changes (https://github.com/webpack/webpack.js.org/tree/fix/v3-docs), we need to work on it now in order to be able to support multiple versions in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's definitely something we need to tackle at some point, but is that something that needs to happen before
rebuild
is merged? Will these routes conflict with the/v3
route you created?Personally I think figure out version management as a follow up after finishing
rebuild
(though I understand we did need to get something up quickly before for v3 when deploying v4).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is indeed a pain point for community, though lets try to keep it to the plan and get
rebuild
into master asap before diving into much detail on doc versioningThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, after merging
rebuild
is fine, would be better to do it before so we can launch new website with multiple versions support, that would make headlines! (jk).I have tried to push that change, without success #1992 :/