Skip to content

Commit f08687c

Browse files
authoredJul 3, 2020
refactor(www): Make easy-to-convert class components into function components (#25489)
* Convert class components to function components * Convert class components to function components * Convert class components to function components * fix * fix
1 parent c9692ab commit f08687c

16 files changed

+782
-891
lines changed
 

‎www/src/components/plugin-searchbar-body.js

+97-103
Original file line numberDiff line numberDiff line change
@@ -197,128 +197,122 @@ const searchBoxStyles = t => css`
197197
/* stylelint-enable */
198198

199199
// Search shows a list of "hits", and is a child of the PluginSearchBar component
200-
class Search extends Component {
201-
render() {
202-
return (
203-
<div sx={{ pb: [11, null, null, 0] }}>
200+
function Search({ pathname, query }) {
201+
return (
202+
<div sx={{ pb: [11, null, null, 0] }}>
203+
<div
204+
sx={{
205+
borderBottomWidth: `1px`,
206+
borderBottomStyle: `solid`,
207+
borderColor: `ui.border`,
208+
display: `flex`,
209+
flexDirection: `column`,
210+
width: `100%`,
211+
}}
212+
>
213+
<Global styles={searchBoxStyles} />
214+
<SearchBox translations={{ placeholder: `Search Gatsby Library` }} />
215+
<div css={{ display: `none` }}>
216+
<Configure analyticsTags={[`gatsby-plugins`]} />
217+
<RefinementList
218+
attribute="keywords"
219+
transformItems={items =>
220+
items.map(({ count, ...item }) => {
221+
return {
222+
...item,
223+
count: count || 0,
224+
}
225+
})
226+
}
227+
defaultRefinement={[`gatsby-component`, `gatsby-plugin`]}
228+
/>
229+
<ToggleRefinement
230+
attribute="deprecated"
231+
value={false}
232+
label="No deprecated plugins"
233+
defaultRefinement={true}
234+
/>
235+
</div>
236+
204237
<div
205238
sx={{
206-
borderBottomWidth: `1px`,
207-
borderBottomStyle: `solid`,
208-
borderColor: `ui.border`,
239+
alignItems: `center`,
240+
color: `textMuted`,
209241
display: `flex`,
210-
flexDirection: `column`,
211-
width: `100%`,
242+
height: searchMetaHeight,
243+
px: 6,
244+
fontSize: 0,
212245
}}
213246
>
214-
<Global styles={searchBoxStyles} />
215-
<SearchBox translations={{ placeholder: `Search Gatsby Library` }} />
216-
<div css={{ display: `none` }}>
217-
<Configure analyticsTags={[`gatsby-plugins`]} />
218-
<RefinementList
219-
attribute="keywords"
220-
transformItems={items =>
221-
items.map(({ count, ...item }) => {
222-
return {
223-
...item,
224-
count: count || 0,
225-
}
226-
})
227-
}
228-
defaultRefinement={[`gatsby-component`, `gatsby-plugin`]}
229-
/>
230-
<ToggleRefinement
231-
attribute="deprecated"
232-
value={false}
233-
label="No deprecated plugins"
234-
defaultRefinement={true}
235-
/>
236-
</div>
237-
238-
<div
239-
sx={{
240-
alignItems: `center`,
241-
color: `textMuted`,
242-
display: `flex`,
243-
height: searchMetaHeight,
244-
px: 6,
245-
fontSize: 0,
246-
}}
247-
>
248-
<Stats
249-
translations={{
250-
stats: function (n) {
251-
return `${n} results`
252-
},
253-
}}
254-
/>
255-
<SkipNavLink />
256-
</div>
257-
</div>
258-
259-
<div>
260-
<div
261-
sx={{
262-
[mediaQueries.md]: {
263-
height: t =>
264-
`calc(100vh - ${t.sizes.headerHeight} - ${t.sizes.bannerHeight} - ${searchInputHeight} - ${searchInputWrapperMargin} - ${searchMetaHeight})`,
265-
overflowY: `scroll`,
247+
<Stats
248+
translations={{
249+
stats: function (n) {
250+
return `${n} results`
266251
},
267252
}}
268-
>
269-
<InfiniteHits
270-
hitComponent={result => (
271-
<Result
272-
hit={result.hit}
273-
pathname={this.props.pathname}
274-
query={this.props.query}
275-
/>
276-
)}
277-
/>
278-
</div>
253+
/>
254+
<SkipNavLink />
279255
</div>
256+
</div>
280257

258+
<div>
281259
<div
282260
sx={{
283-
fontSize: 0,
284-
lineHeight: 0,
285-
height: 20,
286-
mt: 6,
287-
display: `none`,
261+
[mediaQueries.md]: {
262+
height: t =>
263+
`calc(100vh - ${t.sizes.headerHeight} - ${t.sizes.bannerHeight} - ${searchInputHeight} - ${searchInputWrapperMargin} - ${searchMetaHeight})`,
264+
overflowY: `scroll`,
265+
},
288266
}}
289267
>
290-
<a
291-
href={`https://www.algolia.com/`}
292-
sx={{
293-
"&&": {
268+
<InfiniteHits
269+
hitComponent={result => (
270+
<Result hit={result.hit} pathname={pathname} query={query} />
271+
)}
272+
/>
273+
</div>
274+
</div>
275+
276+
<div
277+
sx={{
278+
fontSize: 0,
279+
lineHeight: 0,
280+
height: 20,
281+
mt: 6,
282+
display: `none`,
283+
}}
284+
>
285+
<a
286+
href={`https://www.algolia.com/`}
287+
sx={{
288+
"&&": {
289+
background: `url(${AlgoliaLogo})`,
290+
border: `none`,
291+
fontWeight: `body`,
292+
backgroundRepeat: `no-repeat`,
293+
backgroundPosition: `50%`,
294+
backgroundSize: `100%`,
295+
overflow: `hidden`,
296+
textIndent: `-9000px`,
297+
padding: `0!important`,
298+
width: 110,
299+
height: `100%`,
300+
display: `block`,
301+
ml: `auto`,
302+
"&:hover": {
294303
background: `url(${AlgoliaLogo})`,
295-
border: `none`,
296-
fontWeight: `body`,
297304
backgroundRepeat: `no-repeat`,
298305
backgroundPosition: `50%`,
299306
backgroundSize: `100%`,
300-
overflow: `hidden`,
301-
textIndent: `-9000px`,
302-
padding: `0!important`,
303-
width: 110,
304-
height: `100%`,
305-
display: `block`,
306-
ml: `auto`,
307-
"&:hover": {
308-
background: `url(${AlgoliaLogo})`,
309-
backgroundRepeat: `no-repeat`,
310-
backgroundPosition: `50%`,
311-
backgroundSize: `100%`,
312-
},
313307
},
314-
}}
315-
>
316-
Algolia
317-
</a>
318-
</div>
308+
},
309+
}}
310+
>
311+
Algolia
312+
</a>
319313
</div>
320-
)
321-
}
314+
</div>
315+
)
322316
}
323317

324318
// the result component is fed into the InfiniteHits component

‎www/src/components/stub-list.js

+43-47
Original file line numberDiff line numberDiff line change
@@ -17,58 +17,54 @@ const flatten = pages =>
1717
[]
1818
)
1919

20-
class StubList extends React.Component {
21-
render() {
22-
const stubs = findStubs(
23-
flatten([...itemListContributing.items, ...itemListDocs.items])
24-
)
25-
26-
let groupedStubs = {}
20+
export default function StubList() {
21+
const stubs = findStubs(
22+
flatten([...itemListContributing.items, ...itemListDocs.items])
23+
)
2724

28-
stubs.forEach(stub => {
29-
let categoryTitle = stub.parentTitle || `Top Level Documentation Pages`
25+
let groupedStubs = {}
3026

31-
if (groupedStubs[categoryTitle] === undefined) {
32-
groupedStubs[categoryTitle] = []
33-
}
34-
groupedStubs[categoryTitle].push(stub)
35-
})
27+
stubs.forEach(stub => {
28+
let categoryTitle = stub.parentTitle || `Top Level Documentation Pages`
3629

37-
let sortedCategories = Object.keys(groupedStubs).sort((a, b) =>
38-
a.localeCompare(b)
39-
)
30+
if (groupedStubs[categoryTitle] === undefined) {
31+
groupedStubs[categoryTitle] = []
32+
}
33+
groupedStubs[categoryTitle].push(stub)
34+
})
4035

41-
// Put top level at the front of the array if it isn't empty
42-
sortedCategories.splice(
43-
sortedCategories.indexOf(`Top Level Documentation Pages`),
44-
1
45-
)
36+
let sortedCategories = Object.keys(groupedStubs).sort((a, b) =>
37+
a.localeCompare(b)
38+
)
4639

47-
if (groupedStubs[`Top Level Documentation Pages`]) {
48-
sortedCategories = [`Top Level Documentation Pages`, ...sortedCategories]
49-
}
40+
// Put top level at the front of the array if it isn't empty
41+
sortedCategories.splice(
42+
sortedCategories.indexOf(`Top Level Documentation Pages`),
43+
1
44+
)
5045

51-
return (
52-
<section data-testid="list-of-stubs">
53-
{sortedCategories.map(category => {
54-
let categoryTitle =
55-
category.slice(-1) === `*` ? category.slice(0, -1) : category
56-
return (
57-
<React.Fragment key={category}>
58-
<h2 sx={{ fontSize: 4, mb: 3 }}>{categoryTitle}</h2>
59-
<ul>
60-
{groupedStubs[category].map(stub => (
61-
<li key={stub.title}>
62-
<Link to={stub.link}>{stub.title.slice(0, -1)}</Link>
63-
</li>
64-
))}
65-
</ul>
66-
</React.Fragment>
67-
)
68-
})}
69-
</section>
70-
)
46+
if (groupedStubs[`Top Level Documentation Pages`]) {
47+
sortedCategories = [`Top Level Documentation Pages`, ...sortedCategories]
7148
}
72-
}
7349

74-
export default StubList
50+
return (
51+
<section data-testid="list-of-stubs">
52+
{sortedCategories.map(category => {
53+
let categoryTitle =
54+
category.slice(-1) === `*` ? category.slice(0, -1) : category
55+
return (
56+
<React.Fragment key={category}>
57+
<h2 sx={{ fontSize: 4, mb: 3 }}>{categoryTitle}</h2>
58+
<ul>
59+
{groupedStubs[category].map(stub => (
60+
<li key={stub.title}>
61+
<Link to={stub.link}>{stub.title.slice(0, -1)}</Link>
62+
</li>
63+
))}
64+
</ul>
65+
</React.Fragment>
66+
)
67+
})}
68+
</section>
69+
)
70+
}

‎www/src/pages/creators/agencies.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
import React, { Component } from "react"
1+
import React from "react"
22
import { graphql } from "gatsby"
33
import CreatorsView from "../../views/creators"
44

5-
class AgenciesPage extends Component {
6-
render() {
7-
const { location, data } = this.props
8-
return <CreatorsView location={location} data={data} title={`Agencies`} />
9-
}
5+
export default function AgenciesPage({ location, data }) {
6+
return <CreatorsView location={location} data={data} title={`Agencies`} />
107
}
118

12-
export default AgenciesPage
13-
149
export const pageQuery = graphql`
1510
query {
1611
allCreatorsYaml(filter: { type: { eq: "agency" } }) {

‎www/src/pages/creators/companies.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
import React, { Component } from "react"
1+
import React from "react"
22
import { graphql } from "gatsby"
33
import CreatorsView from "../../views/creators"
44

5-
class CompaniesPage extends Component {
6-
render() {
7-
const { location, data } = this.props
8-
return <CreatorsView data={data} location={location} title={`Companies`} />
9-
}
5+
export default function CompaniesPage({ location, data }) {
6+
return <CreatorsView data={data} location={location} title={`Companies`} />
107
}
118

12-
export default CompaniesPage
13-
149
export const pageQuery = graphql`
1510
query {
1611
allCreatorsYaml(filter: { type: { eq: "company" } }) {

‎www/src/pages/creators/index.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import React, { Component } from "react"
1+
import React from "react"
22
import { graphql } from "gatsby"
33
import CreatorsView from "../../views/creators"
44

5-
class CreatorsPage extends Component {
6-
render() {
7-
const { location, data } = this.props
8-
return <CreatorsView data={data} location={location} title={`All`} />
9-
}
5+
export function CreatorsPage({ location, data }) {
6+
return <CreatorsView data={data} location={location} title={`All`} />
107
}
118

129
export default CreatorsPage

‎www/src/pages/creators/people.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
import React, { Component } from "react"
1+
import React from "react"
22
import { graphql } from "gatsby"
33
import CreatorsView from "../../views/creators"
44

5-
class PeoplePage extends Component {
6-
render() {
7-
const { location, data } = this.props
8-
return <CreatorsView data={data} location={location} title={`People`} />
9-
}
5+
export default function PeoplePage({ location, data }) {
6+
return <CreatorsView data={data} location={location} title={`People`} />
107
}
118

12-
export default PeoplePage
13-
149
export const pageQuery = graphql`
1510
query {
1611
allCreatorsYaml(filter: { type: { eq: "individual" } }) {

‎www/src/pages/ecosystem.js

+28-45
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component } from "react"
1+
import React from "react"
22
import { graphql } from "gatsby"
33

44
import Layout from "../components/layout/layout-with-heading"
@@ -8,57 +8,40 @@ import FooterLinks from "../components/shared/footer-links"
88

99
import { EcosystemIcon } from "../assets/icons"
1010

11-
class EcosystemPage extends Component {
12-
render() {
13-
const {
14-
location,
15-
data: {
16-
allStartersYaml: { nodes: startersData },
17-
allNpmPackage: { nodes: pluginsData },
18-
},
19-
} = this.props
11+
export default function EcosystemPage({ location, data }) {
12+
const startersData = data.allStartersYaml.nodes
13+
const pluginsData = data.allNpmPackage.nodes
2014

21-
const starters = startersData.map(item => {
22-
const {
23-
fields: {
24-
starterShowcase: { slug, name, description, stars },
25-
},
26-
childScreenshot: {
27-
screenshotFile: {
28-
childImageSharp: { fixed: thumbnail },
29-
},
30-
},
31-
} = item
15+
const starters = startersData.map(item => {
16+
const { slug, name, description, stars } = item.fields.starterShowcase
17+
const thumbnail = item.childScreenshot.screenshotFile.childImageSharp.fixed
3218

33-
return {
34-
slug: `/starters${slug}`,
35-
name,
36-
description,
37-
stars,
38-
thumbnail,
39-
}
40-
})
19+
return {
20+
slug: `/starters${slug}`,
21+
name,
22+
description,
23+
stars,
24+
thumbnail,
25+
}
26+
})
4127

42-
const plugins = pluginsData
28+
const plugins = pluginsData
4329

44-
const pageTitle = `Ecosystem`
30+
const pageTitle = `Ecosystem`
4531

46-
return (
47-
<Layout
48-
location={location}
49-
pageTitle={pageTitle}
50-
pageIcon={<EcosystemIcon />}
51-
>
52-
<PageMetadata title="Ecosystem" />
53-
<EcosystemBoard starters={starters} plugins={plugins} />
54-
<FooterLinks />
55-
</Layout>
56-
)
57-
}
32+
return (
33+
<Layout
34+
location={location}
35+
pageTitle={pageTitle}
36+
pageIcon={<EcosystemIcon />}
37+
>
38+
<PageMetadata title="Ecosystem" />
39+
<EcosystemBoard starters={starters} plugins={plugins} />
40+
<FooterLinks />
41+
</Layout>
42+
)
5843
}
5944

60-
export default EcosystemPage
61-
6245
export const ecosystemQuery = graphql`
6346
query EcosystemQuery {
6447
allStartersYaml(

‎www/src/pages/features.js

+29-34
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/** @jsx jsx */
22
import { jsx } from "theme-ui"
3-
import { Component } from "react"
43
import { graphql } from "gatsby"
54

65
import Button from "../components/button"
@@ -101,41 +100,37 @@ const FeaturesHeader = () => (
101100
</section>
102101
)
103102

104-
class FeaturesPage extends Component {
105-
render() {
106-
return (
107-
<PageWithSidebar location={this.props.location}>
108-
<PageMetadata
109-
title="Features"
110-
description="Learn how specific features like performance and support for modern technologies make Gatsby worth using."
111-
/>
112-
<Container>
113-
<main id={`reach-skip-nav`}>
114-
<FeaturesHeader />
115-
<SimpleEvaluationTable
116-
title="Feature Comparison"
117-
headers={[
118-
{ display: `Category`, nodeFieldProperty: `Category` },
119-
{ display: `Gatsby`, nodeFieldProperty: `Gatsby` },
120-
{
121-
display: `JAMstack frameworks`,
122-
nodeFieldProperty: `Jamstack`,
123-
},
124-
{ display: `Traditional CMS`, nodeFieldProperty: `Cms` },
125-
]}
126-
data={this.props.data.allGatsbyFeaturesSpecsCsv.nodes}
127-
/>
128-
<FeaturesFooter />
129-
</main>
130-
<FooterLinks />
131-
</Container>
132-
</PageWithSidebar>
133-
)
134-
}
103+
export default function FeaturesPage({ location, data }) {
104+
return (
105+
<PageWithSidebar location={location}>
106+
<PageMetadata
107+
title="Features"
108+
description="Learn how specific features like performance and support for modern technologies make Gatsby worth using."
109+
/>
110+
<Container>
111+
<main id={`reach-skip-nav`}>
112+
<FeaturesHeader />
113+
<SimpleEvaluationTable
114+
title="Feature Comparison"
115+
headers={[
116+
{ display: `Category`, nodeFieldProperty: `Category` },
117+
{ display: `Gatsby`, nodeFieldProperty: `Gatsby` },
118+
{
119+
display: `JAMstack frameworks`,
120+
nodeFieldProperty: `Jamstack`,
121+
},
122+
{ display: `Traditional CMS`, nodeFieldProperty: `Cms` },
123+
]}
124+
data={data.allGatsbyFeaturesSpecsCsv.nodes}
125+
/>
126+
<FeaturesFooter />
127+
</main>
128+
<FooterLinks />
129+
</Container>
130+
</PageWithSidebar>
131+
)
135132
}
136133

137-
export default FeaturesPage
138-
139134
export const pageQuery = graphql`
140135
query {
141136
allGatsbyFeaturesSpecsCsv {

‎www/src/pages/plugins.js

+105-111
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/** @jsx jsx */
22
import { jsx } from "theme-ui"
3-
import React, { Component } from "react"
43

54
import Container from "../components/container"
65
import Rotator from "../components/rotator"
@@ -11,121 +10,116 @@ import FooterLinks from "../components/shared/footer-links"
1110
import PageMetadata from "../components/page-metadata"
1211
import PageWithPluginSearchBar from "../components/page-with-plugin-searchbar"
1312

14-
class Plugins extends Component {
15-
render() {
16-
const { location } = this.props
17-
return (
18-
<PageWithPluginSearchBar location={location} isPluginsIndex={true}>
19-
<PageMetadata
20-
title="Plugins"
21-
description="The library for searching and exploring Gatsby's vast plugin ecosystem to implement Node.js packages using Gatsby APIs"
22-
/>
23-
<Container
24-
overrideCSS={{
25-
alignItems: `center`,
13+
export default function Plugins({ location }) {
14+
return (
15+
<PageWithPluginSearchBar location={location} isPluginsIndex={true}>
16+
<PageMetadata
17+
title="Plugins"
18+
description="The library for searching and exploring Gatsby's vast plugin ecosystem to implement Node.js packages using Gatsby APIs"
19+
/>
20+
<Container
21+
overrideCSS={{
22+
alignItems: `center`,
23+
display: `flex`,
24+
flexDirection: `column`,
25+
minHeight: `calc(100vh - (${sizes.headerHeight} + ${sizes.bannerHeight}))`,
26+
}}
27+
>
28+
<div
29+
css={{
2630
display: `flex`,
2731
flexDirection: `column`,
28-
minHeight: `calc(100vh - (${sizes.headerHeight} + ${sizes.bannerHeight}))`,
2932
}}
3033
>
31-
<div
32-
css={{
33-
display: `flex`,
34-
flexDirection: `column`,
34+
<img
35+
src={logo}
36+
sx={{
37+
display: `inline-block`,
38+
height: t => t.space[12],
39+
width: t => t.space[12],
40+
mx: `auto`,
41+
}}
42+
alt=""
43+
/>
44+
<h1
45+
sx={{
46+
fontSize: 6,
47+
fontWeight: `heading`,
48+
mx: 5,
49+
mb: 0,
50+
textAlign: `center`,
3551
}}
3652
>
37-
<img
38-
src={logo}
39-
sx={{
40-
display: `inline-block`,
41-
height: t => t.space[12],
42-
width: t => t.space[12],
43-
mx: `auto`,
44-
}}
45-
alt=""
46-
/>
47-
<h1
48-
sx={{
49-
fontSize: 6,
50-
fontWeight: `heading`,
51-
mx: 5,
52-
mb: 0,
53-
textAlign: `center`,
54-
}}
55-
>
56-
Welcome to the Gatsby Plugin Library!
57-
</h1>
58-
<Rotator
59-
items={[
60-
{
61-
text: `SEO?`,
62-
pluginName: `gatsby-plugin-react-helmet`,
63-
},
64-
{
65-
text: `responsive images?`,
66-
pluginName: `gatsby-image`,
67-
},
68-
{
69-
text: `offline support?`,
70-
pluginName: `gatsby-plugin-offline`,
71-
},
72-
{
73-
text: `Sass support?`,
74-
pluginName: `gatsby-plugin-sass`,
75-
},
76-
{
77-
text: `a sitemap?`,
78-
pluginName: `gatsby-plugin-sitemap`,
79-
},
80-
{
81-
text: `an RSS feed?`,
82-
pluginName: `gatsby-plugin-feed`,
83-
},
84-
{
85-
text: `great typography?`,
86-
pluginName: `gatsby-plugin-typography`,
87-
},
88-
{
89-
text: `TypeScript?`,
90-
pluginName: `gatsby-plugin-typescript`,
91-
},
92-
{
93-
text: `Google Analytics?`,
94-
pluginName: `gatsby-plugin-google-analytics`,
95-
},
96-
{
97-
text: `WordPress integration?`,
98-
pluginName: `gatsby-source-wordpress`,
99-
},
100-
{
101-
text: `anything?`,
102-
},
103-
]}
104-
color="lilac"
105-
/>
53+
Welcome to the Gatsby Plugin Library!
54+
</h1>
55+
<Rotator
56+
items={[
57+
{
58+
text: `SEO?`,
59+
pluginName: `gatsby-plugin-react-helmet`,
60+
},
61+
{
62+
text: `responsive images?`,
63+
pluginName: `gatsby-image`,
64+
},
65+
{
66+
text: `offline support?`,
67+
pluginName: `gatsby-plugin-offline`,
68+
},
69+
{
70+
text: `Sass support?`,
71+
pluginName: `gatsby-plugin-sass`,
72+
},
73+
{
74+
text: `a sitemap?`,
75+
pluginName: `gatsby-plugin-sitemap`,
76+
},
77+
{
78+
text: `an RSS feed?`,
79+
pluginName: `gatsby-plugin-feed`,
80+
},
81+
{
82+
text: `great typography?`,
83+
pluginName: `gatsby-plugin-typography`,
84+
},
85+
{
86+
text: `TypeScript?`,
87+
pluginName: `gatsby-plugin-typescript`,
88+
},
89+
{
90+
text: `Google Analytics?`,
91+
pluginName: `gatsby-plugin-google-analytics`,
92+
},
93+
{
94+
text: `WordPress integration?`,
95+
pluginName: `gatsby-source-wordpress`,
96+
},
97+
{
98+
text: `anything?`,
99+
},
100+
]}
101+
color="lilac"
102+
/>
106103

107-
<p
108-
sx={{
109-
color: `textMuted`,
110-
fontSize: 2,
111-
textAlign: `center`,
112-
}}
113-
>
114-
Please use the search bar to find plugins that will make your
115-
blazing fast site even more awesome. If you
116-
{`'`}d like to create your own plugin, see the
117-
{` `}
118-
<Link to="/docs/creating-plugins/">Plugin Authoring</Link> page in
119-
the docs! To learn more about Gatsby plugins, visit the
120-
{` `}
121-
<Link to="/docs/plugins">plugins doc page</Link>.
122-
</p>
123-
</div>
124-
<FooterLinks />
125-
</Container>
126-
</PageWithPluginSearchBar>
127-
)
128-
}
104+
<p
105+
sx={{
106+
color: `textMuted`,
107+
fontSize: 2,
108+
textAlign: `center`,
109+
}}
110+
>
111+
Please use the search bar to find plugins that will make your
112+
blazing fast site even more awesome. If you
113+
{`'`}d like to create your own plugin, see the
114+
{` `}
115+
<Link to="/docs/creating-plugins/">Plugin Authoring</Link> page in
116+
the docs! To learn more about Gatsby plugins, visit the
117+
{` `}
118+
<Link to="/docs/plugins">plugins doc page</Link>.
119+
</p>
120+
</div>
121+
<FooterLinks />
122+
</Container>
123+
</PageWithPluginSearchBar>
124+
)
129125
}
130-
131-
export default Plugins

‎www/src/pages/showcase.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
import React, { Component } from "react"
1+
import React from "react"
22
import { graphql } from "gatsby"
33

44
import ShowcaseView from "../views/showcase"
55

6-
class ShowcasePage extends Component {
7-
render() {
8-
const data = this.props.data
9-
const location = this.props.location
10-
11-
return <ShowcaseView data={data} location={location} />
12-
}
6+
export default function ShowcasePage({ data, location }) {
7+
return <ShowcaseView data={data} location={location} />
138
}
149

15-
export default ShowcasePage
16-
1710
export const showcaseQuery = graphql`
1811
query {
1912
featured: allSitesYaml(

‎www/src/pages/starters.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
import React, { Component } from "react"
1+
import React from "react"
22
import { graphql } from "gatsby"
33

44
import StarterLibraryView from "../views/starter-library"
55

6-
class StarterLibraryWrapper extends Component {
7-
render() {
8-
const data = this.props.data
9-
const location = this.props.location
10-
11-
return <StarterLibraryView data={data} location={location} />
12-
}
6+
export default function StarterLibraryWrapper({ data, location }) {
7+
return <StarterLibraryView data={data} location={location} />
138
}
149

15-
export default StarterLibraryWrapper
16-
1710
export const showcaseQuery = graphql`
1811
query SiteShowcaseQuery {
1912
allStartersYaml(filter: { fields: { hasScreenshot: { eq: true } } }) {

‎www/src/templates/template-blog-list.js

+65-73
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/** @jsx jsx */
22
import { jsx } from "theme-ui"
3-
import React from "react"
43
import { graphql } from "gatsby"
54
import { TiTags as TagsIcon } from "react-icons/ti"
65

@@ -15,86 +14,79 @@ import PageMetadata from "../components/page-metadata"
1514
import { mediaQueries } from "gatsby-design-tokens/dist/theme-gatsbyjs-org"
1615
import { pullIntoGutter, breakpointGutter } from "../utils/styles"
1716

18-
class BlogPostsIndex extends React.Component {
19-
render() {
20-
const { allMdx } = this.props.data
21-
22-
return (
23-
<main id={`reach-skip-nav`}>
24-
<PageMetadata
25-
title={`Blog | Page ${this.props.pageContext.currentPage}`}
26-
/>
27-
<Container>
28-
<div
17+
export default function BlogPostsIndex({ data, pageContext }) {
18+
const posts = data.allMdx.nodes
19+
return (
20+
<main id={`reach-skip-nav`}>
21+
<PageMetadata title={`Blog | Page ${pageContext.currentPage}`} />
22+
<Container>
23+
<div
24+
sx={{
25+
...pullIntoGutter,
26+
display: `flex`,
27+
justifyContent: `space-between`,
28+
borderBottom: t => `1px solid ${t.colors.ui.border}`,
29+
mb: 6,
30+
pb: 6,
31+
[breakpointGutter]: {
32+
pb: 0,
33+
border: 0,
34+
},
35+
}}
36+
>
37+
<h1 sx={{ mb: 0 }}>Blog</h1>
38+
<Button
39+
key="blog-view-all-tags-button"
40+
to="/blog/tags"
41+
variant="small"
42+
>
43+
View all Tags <TagsIcon />
44+
</Button>
45+
</div>
46+
{posts.map((node, index) => (
47+
<BlogPostPreviewItem
48+
post={node}
49+
key={node.fields.slug}
2950
sx={{
51+
borderBottomWidth: `1px`,
52+
borderBottomStyle: `solid`,
53+
borderColor: `ui.border`,
54+
pb: 8,
55+
mb: index === posts.length - 1 ? 0 : 8,
3056
...pullIntoGutter,
31-
display: `flex`,
32-
justifyContent: `space-between`,
33-
borderBottom: t => `1px solid ${t.colors.ui.border}`,
34-
mb: 6,
35-
pb: 6,
3657
[breakpointGutter]: {
37-
pb: 0,
58+
p: 9,
59+
boxShadow: `raised`,
60+
bg: `card.background`,
61+
borderRadius: 2,
3862
border: 0,
39-
},
40-
}}
41-
>
42-
<h1 sx={{ mb: 0 }}>Blog</h1>
43-
<Button
44-
key="blog-view-all-tags-button"
45-
to="/blog/tags"
46-
variant="small"
47-
>
48-
View all Tags <TagsIcon />
49-
</Button>
50-
</div>
51-
{allMdx.nodes.map((node, index) => (
52-
<BlogPostPreviewItem
53-
post={node}
54-
key={node.fields.slug}
55-
sx={{
56-
borderBottomWidth: `1px`,
57-
borderBottomStyle: `solid`,
58-
borderColor: `ui.border`,
59-
pb: 8,
60-
mb: index === allMdx.nodes.length - 1 ? 0 : 8,
61-
...pullIntoGutter,
62-
[breakpointGutter]: {
63-
p: 9,
64-
boxShadow: `raised`,
65-
bg: `card.background`,
66-
borderRadius: 2,
67-
border: 0,
68-
mb: 6,
69-
mx: 0,
70-
transition: t =>
71-
`transform ${t.transition.default}, box-shadow ${t.transition.default}, padding ${t.transition.default}`,
72-
"&:hover": {
73-
transform: t => `translateY(-${t.space[1]})`,
74-
boxShadow: `overlay`,
75-
},
76-
"&:active": {
77-
boxShadow: `cardActive`,
78-
transform: `translateY(0)`,
79-
},
63+
mb: 6,
64+
mx: 0,
65+
transition: t =>
66+
`transform ${t.transition.default}, box-shadow ${t.transition.default}, padding ${t.transition.default}`,
67+
"&:hover": {
68+
transform: t => `translateY(-${t.space[1]})`,
69+
boxShadow: `overlay`,
8070
},
81-
[mediaQueries.md]: {
82-
mx: -9,
71+
"&:active": {
72+
boxShadow: `cardActive`,
73+
transform: `translateY(0)`,
8374
},
84-
}}
85-
/>
86-
))}
87-
<Pagination context={this.props.pageContext} />
88-
<EmailCaptureForm signupMessage="Enjoying our blog? Receive the next post in your inbox!" />
89-
</Container>
90-
<FooterLinks />
91-
</main>
92-
)
93-
}
75+
},
76+
[mediaQueries.md]: {
77+
mx: -9,
78+
},
79+
}}
80+
/>
81+
))}
82+
<Pagination context={pageContext} />
83+
<EmailCaptureForm signupMessage="Enjoying our blog? Receive the next post in your inbox!" />
84+
</Container>
85+
<FooterLinks />
86+
</main>
87+
)
9488
}
9589

96-
export default BlogPostsIndex
97-
9890
export const pageQuery = graphql`
9991
query blogListQuery($skip: Int!, $limit: Int!) {
10092
allMdx(

‎www/src/templates/template-blog-post.js

+143-152
Original file line numberDiff line numberDiff line change
@@ -15,170 +15,161 @@ import Avatar from "../components/avatar"
1515
import PrevAndNext from "../components/prev-and-next"
1616
import FooterLinks from "../components/shared/footer-links"
1717

18-
class BlogPostTemplate extends React.Component {
19-
render() {
20-
const {
21-
pageContext: { prev, next },
22-
data: { mdx: post },
23-
} = this.props
24-
const BioLine = ({ children }) => (
25-
<p
26-
sx={{
27-
color: `textMuted`,
28-
fontFamily: `heading`,
29-
lineHeight: `dense`,
30-
m: 0,
31-
}}
32-
>
33-
{children}
34-
</p>
35-
)
18+
export default function BlogPostTemplate({ pageContext, data }) {
19+
const { prev, next } = pageContext
20+
const post = data.mdx
21+
const BioLine = ({ children }) => (
22+
<p
23+
sx={{
24+
color: `textMuted`,
25+
fontFamily: `heading`,
26+
lineHeight: `dense`,
27+
m: 0,
28+
}}
29+
>
30+
{children}
31+
</p>
32+
)
3633

37-
return (
38-
<>
39-
<Container>
40-
{
41-
// TODO
42-
// - settle on `docSearch-content` as selector to identify
43-
// Algolia DocSearch content
44-
// - make use of components/docsearch-content in place of <main>
45-
//
46-
// `post` and `post-body` are only in use as selectors in the
47-
// docsearch config for gatsbyjs.org for individual blog posts:
48-
// https://github.com/algolia/docsearch-configs/blob/89706210b62e2f384e52ca1b104f92bc0e225fff/configs/gatsbyjs.json#L71-L76
49-
}
50-
<main id={`reach-skip-nav`} className="post docSearch-content">
51-
<BlogPostMetadata post={post} />
52-
<div sx={{ display: `flex`, flexDirection: `column` }}>
53-
<section
54-
sx={{
55-
display: `flex`,
56-
mb: 5,
57-
[mediaQueries.md]: {
58-
mt: 3,
59-
mb: 9,
60-
},
61-
}}
62-
>
63-
<div css={{ flex: `0 0 auto` }}>
64-
<Link
65-
to={post.frontmatter.author.fields.slug}
66-
css={{ "&&": { borderBottom: 0 } }}
34+
return (
35+
<>
36+
<Container>
37+
{
38+
// TODO
39+
// - settle on `docSearch-content` as selector to identify
40+
// Algolia DocSearch content
41+
// - make use of components/docsearch-content in place of <main>
42+
//
43+
// `post` and `post-body` are only in use as selectors in the
44+
// docsearch config for gatsbyjs.org for individual blog posts:
45+
// https://github.com/algolia/docsearch-configs/blob/89706210b62e2f384e52ca1b104f92bc0e225fff/configs/gatsbyjs.json#L71-L76
46+
}
47+
<main id={`reach-skip-nav`} className="post docSearch-content">
48+
<BlogPostMetadata post={post} />
49+
<div sx={{ display: `flex`, flexDirection: `column` }}>
50+
<section
51+
sx={{
52+
display: `flex`,
53+
mb: 5,
54+
[mediaQueries.md]: {
55+
mt: 3,
56+
mb: 9,
57+
},
58+
}}
59+
>
60+
<div css={{ flex: `0 0 auto` }}>
61+
<Link
62+
to={post.frontmatter.author.fields.slug}
63+
css={{ "&&": { borderBottom: 0 } }}
64+
>
65+
<Avatar
66+
image={post.frontmatter.author.avatar.childImageSharp.fixed}
67+
alt={post.frontmatter.author.id}
68+
overrideCSS={{ mr: 5 }}
69+
/>
70+
</Link>
71+
</div>
72+
<div css={{ flex: `1 1 auto` }}>
73+
<Link to={post.frontmatter.author.fields.slug}>
74+
<h4
75+
sx={{
76+
fontSize: 3,
77+
mb: 1,
78+
color: `link.color`,
79+
}}
6780
>
68-
<Avatar
69-
image={
70-
post.frontmatter.author.avatar.childImageSharp.fixed
71-
}
72-
alt={post.frontmatter.author.id}
73-
overrideCSS={{ mr: 5 }}
74-
/>
75-
</Link>
76-
</div>
77-
<div css={{ flex: `1 1 auto` }}>
78-
<Link to={post.frontmatter.author.fields.slug}>
79-
<h4
81+
<span
8082
sx={{
81-
fontSize: 3,
82-
mb: 1,
83-
color: `link.color`,
83+
borderBottom: t => `1px solid ${t.colors.link.border}`,
84+
transition: t =>
85+
`all ${t.transition.speed.fast} ${t.transition.curve.default}`,
86+
"&:hover": { borderColor: `link.hoverBorder` },
8487
}}
8588
>
86-
<span
87-
sx={{
88-
borderBottom: t =>
89-
`1px solid ${t.colors.link.border}`,
90-
transition: t =>
91-
`all ${t.transition.speed.fast} ${t.transition.curve.default}`,
92-
"&:hover": { borderColor: `link.hoverBorder` },
93-
}}
94-
>
95-
{post.frontmatter.author.id}
96-
</span>
97-
</h4>
98-
</Link>
99-
<BioLine>{post.frontmatter.author.bio}</BioLine>
100-
<BioLine>
101-
{post.timeToRead} min read · {post.frontmatter.date}
102-
{post.frontmatter.canonicalLink && (
103-
<span>
104-
{` `}
105-
(originally published at
89+
{post.frontmatter.author.id}
90+
</span>
91+
</h4>
92+
</Link>
93+
<BioLine>{post.frontmatter.author.bio}</BioLine>
94+
<BioLine>
95+
{post.timeToRead} min read · {post.frontmatter.date}
96+
{post.frontmatter.canonicalLink && (
97+
<span>
98+
{` `}
99+
(originally published at
100+
{` `}
101+
<a href={post.frontmatter.canonicalLink}>
102+
{post.fields.publishedAt}
103+
</a>
104+
)
105+
</span>
106+
)}
107+
</BioLine>
108+
</div>
109+
</section>
110+
<h1
111+
sx={{
112+
marginTop: 0,
113+
order: 0,
114+
letterSpacing: `tight`,
115+
lineHeight: `dense`,
116+
fontSize: [6, 7, 8, 9, 11],
117+
[mediaQueries.lg]: {
118+
mb: 8,
119+
},
120+
}}
121+
>
122+
{post.frontmatter.title}
123+
</h1>
124+
{post.frontmatter.image &&
125+
post.frontmatter.showImageInArticle !== false && (
126+
<div
127+
sx={{
128+
mt: 8,
129+
mb: 12,
130+
[mediaQueries.lg]: {
131+
ml: `-8em`,
132+
},
133+
}}
134+
>
135+
<Img fluid={post.frontmatter.image.childImageSharp.fluid} />
136+
{post.frontmatter.imageAuthor &&
137+
post.frontmatter.imageAuthorLink && (
138+
<em>
139+
Image by
106140
{` `}
107-
<a href={post.frontmatter.canonicalLink}>
108-
{post.fields.publishedAt}
141+
<a href={post.frontmatter.imageAuthorLink}>
142+
{post.frontmatter.imageAuthor}
109143
</a>
110-
)
111-
</span>
144+
</em>
112145
)}
113-
</BioLine>
114146
</div>
115-
</section>
116-
<h1
117-
sx={{
118-
marginTop: 0,
119-
order: 0,
120-
letterSpacing: `tight`,
121-
lineHeight: `dense`,
122-
fontSize: [6, 7, 8, 9, 11],
123-
[mediaQueries.lg]: {
124-
mb: 8,
125-
},
126-
}}
127-
>
128-
{post.frontmatter.title}
129-
</h1>
130-
{post.frontmatter.image &&
131-
post.frontmatter.showImageInArticle !== false && (
132-
<div
133-
sx={{
134-
mt: 8,
135-
mb: 12,
136-
[mediaQueries.lg]: {
137-
ml: `-8em`,
138-
},
139-
}}
140-
>
141-
<Img fluid={post.frontmatter.image.childImageSharp.fluid} />
142-
{post.frontmatter.imageAuthor &&
143-
post.frontmatter.imageAuthorLink && (
144-
<em>
145-
Image by
146-
{` `}
147-
<a href={post.frontmatter.imageAuthorLink}>
148-
{post.frontmatter.imageAuthor}
149-
</a>
150-
</em>
151-
)}
152-
</div>
153-
)}
154-
</div>
155-
<section className="post-body">
156-
<MDXRenderer>{post.body}</MDXRenderer>
157-
</section>
158-
<TagsSection tags={post.frontmatter.tags} />
159-
<EmailCaptureForm />
160-
</main>
147+
)}
148+
</div>
149+
<section className="post-body">
150+
<MDXRenderer>{post.body}</MDXRenderer>
151+
</section>
152+
<TagsSection tags={post.frontmatter.tags} />
153+
<EmailCaptureForm />
154+
</main>
155+
</Container>
156+
<div
157+
sx={{
158+
borderTop: t => `1px solid ${t.colors.ui.border}`,
159+
mt: 9,
160+
[mediaQueries.md]: { pt: 5 },
161+
[mediaQueries.lg]: { pt: 7 },
162+
}}
163+
>
164+
<Container>
165+
<PrevAndNext prev={prev} next={next} />
161166
</Container>
162-
<div
163-
sx={{
164-
borderTop: t => `1px solid ${t.colors.ui.border}`,
165-
mt: 9,
166-
[mediaQueries.md]: { pt: 5 },
167-
[mediaQueries.lg]: { pt: 7 },
168-
}}
169-
>
170-
<Container>
171-
<PrevAndNext prev={prev} next={next} />
172-
</Container>
173-
<FooterLinks />
174-
</div>
175-
</>
176-
)
177-
}
167+
<FooterLinks />
168+
</div>
169+
</>
170+
)
178171
}
179172

180-
export default BlogPostTemplate
181-
182173
export const pageQuery = graphql`
183174
query($slug: String!) {
184175
mdx(fields: { slug: { eq: $slug } }) {

‎www/src/templates/template-creator-details.js

+153-162
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** @jsx jsx */
22
import { jsx } from "theme-ui"
3-
import React, { Component } from "react"
3+
import React from "react"
44
import { graphql } from "gatsby"
55
import Link from "../components/localized-link"
66
import Img from "gatsby-image"
@@ -58,188 +58,179 @@ const MetaSection = ({ children, background, last, first }) => (
5858
</div>
5959
)
6060

61-
class CreatorTemplate extends Component {
62-
render() {
63-
const { data } = this.props
64-
const creator = data.creatorsYaml
65-
const isAgencyOrCompany =
66-
creator.type === `agency` || creator.type === `company`
61+
export default function CreatorTemplate({ data }) {
62+
const creator = data.creatorsYaml
63+
const isAgencyOrCompany =
64+
creator.type === `agency` || creator.type === `company`
6765

68-
const sites = data.allSitesYaml.nodes
66+
const sites = data.allSitesYaml.nodes
6967

70-
return (
71-
<React.Fragment>
72-
<PageMetadata
73-
title={`${creator.name} - Creator`}
74-
description={creator.description}
75-
/>
76-
<CreatorsHeader submissionText="Add Yourself" />
77-
<main
78-
role="main"
68+
return (
69+
<React.Fragment>
70+
<PageMetadata
71+
title={`${creator.name} - Creator`}
72+
description={creator.description}
73+
/>
74+
<CreatorsHeader submissionText="Add Yourself" />
75+
<main
76+
role="main"
77+
sx={{
78+
p: 6,
79+
pb: `10vh`,
80+
display: `flex`,
81+
flexDirection: `column`,
82+
alignItems: `center`,
83+
justifyContent: `center`,
84+
width: `100%`,
85+
[breakpoint2Columns]: {
86+
pb: 6,
87+
flexDirection: `row`,
88+
alignItems: `flex-start`,
89+
},
90+
}}
91+
>
92+
<div
7993
sx={{
80-
p: 6,
81-
pb: `10vh`,
82-
display: `flex`,
83-
flexDirection: `column`,
84-
alignItems: `center`,
85-
justifyContent: `center`,
94+
m: 6,
95+
mb: 1,
96+
flexGrow: `1`,
8697
width: `100%`,
8798
[breakpoint2Columns]: {
88-
pb: 6,
89-
flexDirection: `row`,
90-
alignItems: `flex-start`,
99+
width: `auto`,
100+
maxWidth: 480,
101+
},
102+
[mediaQueries.lg]: {
103+
maxWidth: 560,
91104
},
92105
}}
93106
>
107+
<Img
108+
alt={`${creator.name}`}
109+
sx={{ borderRadius: 1 }}
110+
fluid={creator.image.childImageSharp.fluid}
111+
/>
112+
</div>
113+
<div
114+
sx={{
115+
m: 6,
116+
flex: `1`,
117+
width: `100%`,
118+
[mediaQueries.lg]: {
119+
width: `auto`,
120+
maxWidth: 640,
121+
},
122+
}}
123+
>
124+
<h1 sx={{ m: 0 }}>{creator.name}</h1>
94125
<div
95-
sx={{
96-
m: 6,
97-
mb: 1,
98-
flexGrow: `1`,
99-
width: `100%`,
100-
[breakpoint2Columns]: {
101-
width: `auto`,
102-
maxWidth: 480,
103-
},
104-
[mediaQueries.lg]: {
105-
maxWidth: 560,
106-
},
107-
}}
108-
>
109-
<Img
110-
alt={`${creator.name}`}
111-
sx={{ borderRadius: 1 }}
112-
fluid={creator.image.childImageSharp.fluid}
113-
/>
114-
</div>
115-
<div
116-
sx={{
117-
m: 6,
118-
flex: `1`,
119-
width: `100%`,
120-
[mediaQueries.lg]: {
121-
width: `auto`,
122-
maxWidth: 640,
123-
},
126+
css={{
127+
alignItems: `center`,
128+
display: `flex`,
129+
mt: 3,
124130
}}
125131
>
126-
<h1 sx={{ m: 0 }}>{creator.name}</h1>
127-
<div
128-
css={{
129-
alignItems: `center`,
130-
display: `flex`,
131-
mt: 3,
132-
}}
133-
>
134-
{isAgencyOrCompany && (
135-
<span
136-
sx={{
137-
color: `textMuted`,
138-
mr: 2,
139-
}}
140-
>
141-
{creator.type.charAt(0).toUpperCase() + creator.type.slice(1)}
142-
</span>
143-
)}
132+
{isAgencyOrCompany && (
133+
<span
134+
sx={{
135+
color: `textMuted`,
136+
mr: 2,
137+
}}
138+
>
139+
{creator.type.charAt(0).toUpperCase() + creator.type.slice(1)}
140+
</span>
141+
)}
144142

145-
{creator.for_hire || creator.hiring ? (
146-
<div
147-
sx={{
148-
alignSelf: `flex-start`,
149-
fontSize: 1,
150-
mr: 2,
151-
}}
152-
>
153-
<Badge
154-
forHire={creator.for_hire}
155-
overrideCSS={{
156-
background: `green.50`,
157-
color: `white`,
158-
}}
159-
>
160-
{creator.for_hire ? `Open for work` : `Hiring`}
161-
</Badge>
162-
</div>
163-
) : null}
164-
{creator.github && (
165-
<a
166-
href={creator.github}
167-
sx={{
168-
"& svg": { display: `block` },
169-
"&&": {
170-
border: 0,
171-
lineHeight: `solid`,
172-
"&:hover": {
173-
color: `gatsby`,
174-
},
175-
},
143+
{creator.for_hire || creator.hiring ? (
144+
<div
145+
sx={{
146+
alignSelf: `flex-start`,
147+
fontSize: 1,
148+
mr: 2,
149+
}}
150+
>
151+
<Badge
152+
forHire={creator.for_hire}
153+
overrideCSS={{
154+
background: `green.50`,
155+
color: `white`,
176156
}}
177157
>
178-
<GithubIcon />
179-
</a>
180-
)}
181-
</div>
182-
<div sx={{ py: 6 }}>{creator.description}</div>
183-
<MetaSection first>
184-
<MetaTitle>Get in touch</MetaTitle>
158+
{creator.for_hire ? `Open for work` : `Hiring`}
159+
</Badge>
160+
</div>
161+
) : null}
162+
{creator.github && (
185163
<a
186-
href={creator.website}
187-
target="_blank"
188-
rel="noopener noreferrer"
164+
href={creator.github}
165+
sx={{
166+
"& svg": { display: `block` },
167+
"&&": {
168+
border: 0,
169+
lineHeight: `solid`,
170+
"&:hover": {
171+
color: `gatsby`,
172+
},
173+
},
174+
}}
189175
>
190-
{removeProtocol(creator.website)}
176+
<GithubIcon />
191177
</a>
192-
</MetaSection>
193-
<MetaSection>
194-
<MetaTitle>From</MetaTitle>
195-
<p sx={{ m: 0 }}>{creator.location}</p>
196-
</MetaSection>
197-
{creator.portfolio === true && sites.length > 0 && (
198-
<MetaSection background="transparent" last>
199-
<MetaTitle>Worked On</MetaTitle>
200-
<div
201-
css={{
202-
display: `flex`,
203-
alignItems: `flex-start`,
204-
flexWrap: `wrap`,
205-
}}
206-
>
207-
{sites.map(site => (
208-
<Link
209-
key={site.title}
210-
sx={{
211-
"&&": {
212-
mr: 6,
213-
mb: 6,
214-
borderBottom: `none`,
215-
lineHeight: 0,
216-
transition: `default`,
217-
},
218-
}}
219-
to={site.fields.slug}
220-
>
221-
<Img
222-
alt={`${site.title}`}
223-
fixed={
224-
site.childScreenshot.screenshotFile.childImageSharp
225-
.fixed
226-
}
227-
/>
228-
</Link>
229-
))}
230-
</div>
231-
</MetaSection>
232178
)}
233179
</div>
234-
</main>
235-
<FooterLinks />
236-
</React.Fragment>
237-
)
238-
}
180+
<div sx={{ py: 6 }}>{creator.description}</div>
181+
<MetaSection first>
182+
<MetaTitle>Get in touch</MetaTitle>
183+
<a href={creator.website} target="_blank" rel="noopener noreferrer">
184+
{removeProtocol(creator.website)}
185+
</a>
186+
</MetaSection>
187+
<MetaSection>
188+
<MetaTitle>From</MetaTitle>
189+
<p sx={{ m: 0 }}>{creator.location}</p>
190+
</MetaSection>
191+
{creator.portfolio === true && sites.length > 0 && (
192+
<MetaSection background="transparent" last>
193+
<MetaTitle>Worked On</MetaTitle>
194+
<div
195+
css={{
196+
display: `flex`,
197+
alignItems: `flex-start`,
198+
flexWrap: `wrap`,
199+
}}
200+
>
201+
{sites.map(site => (
202+
<Link
203+
key={site.title}
204+
sx={{
205+
"&&": {
206+
mr: 6,
207+
mb: 6,
208+
borderBottom: `none`,
209+
lineHeight: 0,
210+
transition: `default`,
211+
},
212+
}}
213+
to={site.fields.slug}
214+
>
215+
<Img
216+
alt={`${site.title}`}
217+
fixed={
218+
site.childScreenshot.screenshotFile.childImageSharp
219+
.fixed
220+
}
221+
/>
222+
</Link>
223+
))}
224+
</div>
225+
</MetaSection>
226+
)}
227+
</div>
228+
</main>
229+
<FooterLinks />
230+
</React.Fragment>
231+
)
239232
}
240233

241-
export default CreatorTemplate
242-
243234
export const pageQuery = graphql`
244235
query($slug: String!, $name: String!) {
245236
creatorsYaml(fields: { slug: { eq: $slug } }) {

‎www/src/templates/template-feature-comparison.js

+46-55
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/** @jsx jsx */
22
import { jsx } from "theme-ui"
3-
import { Component } from "react"
43
import { css } from "@emotion/core"
54
import PageWithSidebar from "../components/page-with-sidebar"
65
import PageMetadata from "../components/page-metadata"
@@ -16,66 +15,58 @@ import { getFeaturesData } from "../utils/get-csv-features-data"
1615

1716
import { graphql } from "gatsby"
1817

19-
class FeatureComparison extends Component {
20-
render() {
21-
const {
22-
pageContext: { options, featureType },
23-
location,
24-
data,
25-
} = this.props
26-
const optionsDisplay = options.map(o => o.display)
27-
const titleString = `Comparison of Gatsby vs ${optionsDisplay.join(` vs `)}`
18+
export default function FeatureComparison({ pageContext, location, data }) {
19+
const { options, featureType } = pageContext
20+
const optionsDisplay = options.map(o => o.display)
21+
const titleString = `Comparison of Gatsby vs ${optionsDisplay.join(` vs `)}`
2822

29-
const { sections, sectionHeaders } =
30-
featureType === `cms`
31-
? getFeaturesData(data.allGatsbyCmsSpecsCsv.nodes)
32-
: getFeaturesData(data.allGatsbyJamstackSpecsCsv.nodes)
23+
const { sections, sectionHeaders } =
24+
featureType === `cms`
25+
? getFeaturesData(data.allGatsbyCmsSpecsCsv.nodes)
26+
: getFeaturesData(data.allGatsbyJamstackSpecsCsv.nodes)
3327

34-
return (
35-
<PageWithSidebar location={location}>
36-
<PageMetadata title={titleString} />
37-
<Container>
38-
<main>
39-
<Breadcrumb location={location} />
40-
<h1>{titleString}</h1>
41-
{options.map(o => (
42-
<section key={o.key} sx={{ mb: 6 }}>
43-
<h2
28+
return (
29+
<PageWithSidebar location={location}>
30+
<PageMetadata title={titleString} />
31+
<Container>
32+
<main>
33+
<Breadcrumb location={location} />
34+
<h1>{titleString}</h1>
35+
{options.map(o => (
36+
<section key={o.key} sx={{ mb: 6 }}>
37+
<h2
38+
css={css`
39+
display: flex;
40+
align-items: center;
41+
`}
42+
>
43+
<img
44+
src={LogoDictionary[o.key]}
4445
css={css`
45-
display: flex;
46-
align-items: center;
46+
height: 25px;
47+
margin-bottom: 0;
48+
margin-right: 10px;
4749
`}
48-
>
49-
<img
50-
src={LogoDictionary[o.key]}
51-
css={css`
52-
height: 25px;
53-
margin-bottom: 0;
54-
margin-right: 10px;
55-
`}
56-
/>
57-
{o.display}
58-
</h2>
59-
{o.description}
60-
</section>
61-
))}
62-
<LegendTable />
63-
<EvaluationTable
64-
options={options}
65-
sections={sections}
66-
sectionHeaders={sectionHeaders}
67-
/>
68-
</main>
69-
<FeaturesFooter />
70-
<FooterLinks />
71-
</Container>
72-
</PageWithSidebar>
73-
)
74-
}
50+
/>
51+
{o.display}
52+
</h2>
53+
{o.description}
54+
</section>
55+
))}
56+
<LegendTable />
57+
<EvaluationTable
58+
options={options}
59+
sections={sections}
60+
sectionHeaders={sectionHeaders}
61+
/>
62+
</main>
63+
<FeaturesFooter />
64+
<FooterLinks />
65+
</Container>
66+
</PageWithSidebar>
67+
)
7568
}
7669

77-
export default FeatureComparison
78-
7970
export const pageQuery = graphql`
8071
query {
8172
allGatsbyCmsSpecsCsv {
+55-59
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,75 @@
11
/** @jsx jsx */
22
import { jsx } from "theme-ui"
3-
import { Component } from "react"
43
import Link from "../../components/localized-link"
54
import Button from "../../components/button"
65
import { MdArrowForward as ArrowForwardIcon } from "react-icons/md"
76

8-
class CreatorsHeader extends Component {
9-
render() {
10-
const { /*forHire, hiring,*/ submissionText } = this.props
11-
return (
12-
<div
13-
sx={{
14-
alignItems: `center`,
15-
backgroundColor: `navigation.background`,
16-
borderBottom: t => `1px solid ${t.colors.ui.border}`,
7+
export default function CreatorsHeader({
8+
/*forHire, hiring, */ submissionText,
9+
}) {
10+
return (
11+
<div
12+
sx={{
13+
alignItems: `center`,
14+
backgroundColor: `navigation.background`,
15+
borderBottom: t => `1px solid ${t.colors.ui.border}`,
16+
display: `flex`,
17+
flexDirection: `row`,
18+
fontFamily: `heading`,
19+
height: `headerHeight`,
20+
px: 6,
21+
zIndex: `2`,
22+
}}
23+
>
24+
<h1
25+
css={{
1726
display: `flex`,
18-
flexDirection: `row`,
19-
fontFamily: `heading`,
20-
height: `headerHeight`,
21-
px: 6,
22-
zIndex: `2`,
27+
height: `100%`,
28+
margin: 0,
2329
}}
2430
>
25-
<h1
26-
css={{
27-
display: `flex`,
28-
height: `100%`,
29-
margin: 0,
31+
<Link
32+
to="/creators/"
33+
state={{ filter: `` }}
34+
sx={{
35+
alignSelf: `center`,
36+
"&&": {
37+
borderBottom: `none`,
38+
color: `gatsby`,
39+
fontSize: 4,
40+
mr: 3,
41+
"&:hover": {
42+
backgroundColor: `initial`,
43+
},
44+
},
3045
}}
3146
>
32-
<Link
33-
to="/creators/"
34-
state={{ filter: `` }}
35-
sx={{
36-
alignSelf: `center`,
37-
"&&": {
38-
borderBottom: `none`,
39-
color: `gatsby`,
40-
fontSize: 4,
41-
mr: 3,
42-
"&:hover": {
43-
backgroundColor: `initial`,
44-
},
45-
},
46-
}}
47-
>
48-
Creators
49-
</Link>
50-
</h1>
47+
Creators
48+
</Link>
49+
</h1>
50+
<div
51+
className="creators--filters"
52+
css={{
53+
display: `flex`,
54+
flex: `2`,
55+
}}
56+
>
5157
<div
52-
className="creators--filters"
5358
css={{
59+
alignItems: `center`,
5460
display: `flex`,
55-
flex: `2`,
61+
marginLeft: `auto`,
5662
}}
5763
>
58-
<div
59-
css={{
60-
alignItems: `center`,
61-
display: `flex`,
62-
marginLeft: `auto`,
63-
}}
64+
<Button
65+
variant="small"
66+
to="/contributing/submit-to-creator-showcase/"
67+
icon={<ArrowForwardIcon />}
6468
>
65-
<Button
66-
variant="small"
67-
to="/contributing/submit-to-creator-showcase/"
68-
icon={<ArrowForwardIcon />}
69-
>
70-
{submissionText}
71-
</Button>
72-
</div>
69+
{submissionText}
70+
</Button>
7371
</div>
7472
</div>
75-
)
76-
}
73+
</div>
74+
)
7775
}
78-
79-
export default CreatorsHeader

0 commit comments

Comments
 (0)
Please sign in to comment.