spaCy/website/src/widgets/styleguide.js
Ines Montani e597110d31
💫 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 19:31:19 +01:00

112 lines
3.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react'
import Grid from '../components/grid'
import { Label } from '../components/typography'
import Link from '../components/link'
import { ReactComponent as Logo } from '../images/logo.svg'
import patternBlue from '../images/pattern_blue.jpg'
import patternGreen from '../images/pattern_green.jpg'
import patternPurple from '../images/pattern_purple.jpg'
const colors = {
dark: 'var(--color-front)',
medium: 'var(--color-dark)',
light: 'var(--color-subtle)',
faint: 'var(--color-subtle-light)',
blue: 'var(--color-theme-blue)',
'dark blue': 'var(--color-theme-blue-dark)',
green: 'var(--color-theme-green)',
'dark green': 'var(--color-theme-green-dark)',
purple: 'var(--color-theme-purple)',
'dark purple': 'var(--color-theme-purple-dark)',
red: 'var(--color-red-medium)',
'light red': 'var(--color-red-light)',
yellow: 'var(--color-yellow-medium)',
'light yellow': 'var(--color-yellow-light)',
}
const patterns = {
'blue pattern': patternBlue,
'green pattern': patternGreen,
'purple pattern': patternPurple,
}
const Card = ({ style = {}, children }) => (
<div
style={{
borderRadius: 'var(--border-radius)',
boxShadow: 'var(--box-shadow)',
marginBottom: 'var(--spacing-sm)',
}}
>
<div
style={{
borderTopLeftRadius: 'var(--border-radius)',
borderTopRightRadius: 'var(--border-radius)',
...style,
}}
/>
<div style={{ textAlign: 'center', padding: '1.5rem 0' }}>{children}</div>
</div>
)
export const Colors = () => (
<Grid cols={4} narrow>
{Object.keys(colors).map(name => (
<Card key={name} style={{ height: 80, background: colors[name] }}>
<Label>{name}</Label>
</Card>
))}
</Grid>
)
export const Patterns = () => {
const imgStyle = name => ({
height: 125,
background: `url(${patterns[name]}) center/150% repeat`,
})
const textStyle = { fontSize: 'var(--font-size-xs)', color: 'var(--color-subtle-dark)' }
const linkStyle = { color: 'var(--color-dark)' }
return (
<Grid cols={3} narrow>
{Object.keys(patterns).map(name => (
<Card key={name} style={imgStyle(name)}>
<Label>{name}</Label>
<span style={textStyle}>
by
<Link to="https://dribbble.com/kemal" hidden style={linkStyle} ws>
Kemal Şanlı
</Link>
</span>
</Card>
))}
</Grid>
)
}
export const Logos = () => {
const style = {
padding: '0 3rem',
border: '1px solid var(--color-subtle)',
borderRadius: 'var(--border-radius)',
boxShadow: 'var(--box-shadow)',
}
return (
<Grid cols={2} narrow>
<div style={style}>
<Logo />
</div>
<div
style={{
...style,
background: 'var(--color-theme-blue)',
borderColor: 'var(--color-theme-blue)',
}}
>
<Logo style={{ color: 'var(--color-back)' }} />
</div>
</Grid>
)
}