💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
import React from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
import classNames from 'classnames'
|
|
|
|
|
|
|
|
import Link from './link'
|
|
|
|
import Icon from './icon'
|
2019-02-26 18:51:22 +03:00
|
|
|
import Dropdown from './dropdown'
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
import { github } from './util'
|
|
|
|
import { ReactComponent as Logo } from '../images/logo.svg'
|
|
|
|
import classes from '../styles/navigation.module.sass'
|
|
|
|
|
2019-02-26 18:51:22 +03:00
|
|
|
const NavigationDropdown = ({ items, section }) => {
|
2019-02-25 22:11:11 +03:00
|
|
|
const active = items.find(({ text }) => text.toLowerCase() === section)
|
|
|
|
const defaultValue = active ? active.url : 'title'
|
|
|
|
return (
|
2019-02-26 18:51:22 +03:00
|
|
|
<Dropdown defaultValue={defaultValue} className={classes.dropdown}>
|
2019-02-25 22:11:11 +03:00
|
|
|
<option value="title" disabled>
|
|
|
|
Menu
|
|
|
|
</option>
|
|
|
|
{items.map(({ text, url }, i) => (
|
|
|
|
<option key={i} value={url}>
|
|
|
|
{text}
|
|
|
|
</option>
|
|
|
|
))}
|
2019-02-26 18:51:22 +03:00
|
|
|
</Dropdown>
|
2019-02-25 22:11:11 +03:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const Navigation = ({ title, items, section, search, children }) => {
|
|
|
|
return (
|
|
|
|
<nav className={classes.root}>
|
|
|
|
<Link to="/" aria-label={title} hidden>
|
|
|
|
<h1 className={classes.title}>{title}</h1>
|
|
|
|
<Logo className={classes.logo} width={300} height={96} />
|
|
|
|
</Link>
|
|
|
|
|
|
|
|
<div className={classes.menu}>
|
2019-02-26 18:51:22 +03:00
|
|
|
<NavigationDropdown items={items} section={section} />
|
2019-02-25 22:11:11 +03:00
|
|
|
|
|
|
|
<ul className={classes.list}>
|
|
|
|
{items.map(({ text, url }, i) => {
|
|
|
|
const isActive = section && text.toLowerCase() === section
|
|
|
|
const itemClassNames = classNames(classes.item, {
|
|
|
|
[classes.isActive]: isActive,
|
|
|
|
})
|
|
|
|
return (
|
|
|
|
<li key={i} className={itemClassNames}>
|
|
|
|
<Link to={url} tabIndex={isActive ? '-1' : null} hidden>
|
|
|
|
{text}
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
)
|
|
|
|
})}
|
|
|
|
<li className={classes.item}>
|
|
|
|
<Link to={github()} aria-label="GitHub" hidden>
|
|
|
|
<Icon name="github" />
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
</Link>
|
|
|
|
</li>
|
2019-02-25 22:11:11 +03:00
|
|
|
</ul>
|
|
|
|
{search && <div className={classes.search}>{search}</div>}
|
|
|
|
</div>
|
|
|
|
{children}
|
|
|
|
</nav>
|
|
|
|
)
|
|
|
|
}
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
|
|
|
|
Navigation.defaultProps = {
|
|
|
|
items: [],
|
|
|
|
}
|
|
|
|
|
|
|
|
Navigation.propTypes = {
|
|
|
|
title: PropTypes.string.isRequired,
|
|
|
|
items: PropTypes.arrayOf(
|
|
|
|
PropTypes.shape({
|
|
|
|
text: PropTypes.string.isRequired,
|
|
|
|
url: PropTypes.string.isRequired,
|
|
|
|
})
|
|
|
|
),
|
|
|
|
section: PropTypes.string,
|
2019-02-25 22:11:11 +03:00
|
|
|
search: PropTypes.node,
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export default Navigation
|