-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: migrate website to Gatsby v2 (#1623)
* website: initial conversion to gatsby v2 * fix unexpected history use warning * use commonjs only to fix gatsby error * fix gatsby import error with sidecar * remove unused postcss-colour-functions * remove unused prop * lowercase layout filename import to match actual file * chore(lint): format code
- Loading branch information
Showing
17 changed files
with
4,095 additions
and
4,673 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const neatgrid = require('postcss-neat'); | ||
const nestedcss = require('postcss-nested'); | ||
// const colorfunctions = require('postcss-colour-functions'); | ||
const hdBackgrounds = require('postcss-at2x'); | ||
const cssextend = require('postcss-simple-extend'); | ||
const cssvars = require('postcss-simple-vars-async'); | ||
|
||
const styleVariables = require('./src/theme'); | ||
|
||
module.exports = () => ({ | ||
plugins: [ | ||
neatgrid(), | ||
nestedcss(), | ||
// colorfunctions(), | ||
hdBackgrounds(), | ||
cssextend(), | ||
cssvars({ variables: styleVariables }), | ||
], | ||
}); |
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React, { Fragment } from 'react'; | ||
import Helmet from 'react-helmet'; | ||
import classnames from 'classnames'; | ||
import { graphql, StaticQuery } from 'gatsby'; | ||
|
||
import Header from './header'; | ||
import Footer from './footer'; | ||
|
||
import '../css/imports/base.css'; | ||
import '../css/imports/utilities.css'; | ||
import '../css/imports/gitter.css'; | ||
|
||
const Layout = ({ children }) => { | ||
return ( | ||
<StaticQuery | ||
query={graphql` | ||
query layoutQuery { | ||
site { | ||
siteMetadata { | ||
title | ||
description | ||
} | ||
} | ||
footer: file(relativePath: { regex: "/global/" }) { | ||
childDataYaml { | ||
footer { | ||
buttons { | ||
url | ||
name | ||
} | ||
} | ||
} | ||
} | ||
notifs: file(relativePath: { regex: "/notifications/" }) { | ||
childDataYaml { | ||
notifications { | ||
published | ||
loud | ||
message | ||
url | ||
} | ||
} | ||
} | ||
} | ||
`} | ||
> | ||
{data => { | ||
const { title, description } = data.site.siteMetadata; | ||
const notifs = data.notifs.childDataYaml.notifications.filter(notif => notif.published); | ||
|
||
return ( | ||
<Fragment> | ||
<Helmet defaultTitle={title} titleTemplate={`%s | ${title}`}> | ||
<meta name="description" content={description} /> | ||
</Helmet> | ||
{notifs.map((node, i) => ( | ||
<a | ||
key={i} | ||
href={node.url} | ||
className={classnames('notification', { | ||
'notification-loud': node.loud, | ||
})} | ||
> | ||
{node.message} | ||
</a> | ||
))} | ||
<Header notifications={notifs} /> | ||
{children} | ||
<Footer buttons={data.footer.childDataYaml.footer.buttons} /> | ||
</Fragment> | ||
); | ||
}} | ||
</StaticQuery> | ||
); | ||
}; | ||
|
||
export default Layout; |
This file contains 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 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,22 +1,10 @@ | ||
import React from 'react'; | ||
import Gitter from 'react-sidecar'; | ||
// gatsby throws some error when importing just react-sidecar. | ||
// Maybe because jsx file ext? | ||
import Gitter from 'react-sidecar/dist-modules/index.js'; | ||
|
||
let stylesStr; | ||
if (process.env.NODE_ENV === `production`) { | ||
try { | ||
stylesStr = require('!raw-loader!../public/styles.css'); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
} | ||
|
||
module.exports = class HTML extends React.Component { | ||
class HTML extends React.Component { | ||
render() { | ||
let css; | ||
if (process.env.NODE_ENV === 'production') { | ||
css = <style id="gatsby-inlined-css" dangerouslySetInnerHTML={{ __html: stylesStr }} />; | ||
} | ||
|
||
return ( | ||
<html {...this.props.htmlAttributes}> | ||
<head> | ||
|
@@ -30,7 +18,6 @@ module.exports = class HTML extends React.Component { | |
<meta name="apple-mobile-web-app-title" content="NetlifyCMS" /> | ||
<meta name="application-name" content="NetlifyCMS" /> | ||
{this.props.headComponents} | ||
{css} | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/[email protected]/dist/cdn/docsearch.min.css" | ||
|
@@ -47,4 +34,6 @@ module.exports = class HTML extends React.Component { | |
</html> | ||
); | ||
} | ||
}; | ||
} | ||
|
||
export default HTML; |
Oops, something went wrong.