Skip to content

Commit

Permalink
feat(www): Ecosystem landing page (gatsbyjs#9442)
Browse files Browse the repository at this point in the history
* feat(www): prepare featured items forEcosystem

* feat(www): add new icons for Ecosystem

* feat(www): Ecosystem content

* feat(www): create Ecosystem mobile styles

* feat(www): add new variant of Button

* feat(www): Ecosystem desktop styles

* feat(www): add thumbnail to featured starters

* fix(www): fix button label

* fix(www): fix typo

* refactor(www): prettify svg code

* refactor(www): remove unnecessary destructuring

* fix(www): use slug to pick up featured starters

* refactor(www): remove unnecessary  spreading to a new object

* fix(www): fix stylelint errors

* fix(www): use gatsby-transformer-yaml to pull featured Ecosystem items

* feat(www): add backkground icons to test it

* refactor(www): remove unnecessary destructuring in Button

* fix(www): remove unnecessary infos

* fix(www): remove background

* feat(www): add function preventing too long description of featured items

* fix(www): add border to starter thumbnails

* fix(www): refine Tablet styles

* fix(www): fix desktop section height on FF

* fix(www): change Ecosystem sections headers

* fix(www): remove unused imports
  • Loading branch information
greglobinski authored and gpetrioli committed Jan 22, 2019
1 parent fc20bd9 commit 2328094
Show file tree
Hide file tree
Showing 16 changed files with 716 additions and 85 deletions.
7 changes: 7 additions & 0 deletions www/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ module.exports = {
path: `${__dirname}/../packages/`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `ecosystem`,
path: `${__dirname}/src/data/ecosystem/`,
},
},
{
resolve: `gatsby-plugin-typography`,
options: {
Expand Down
149 changes: 87 additions & 62 deletions www/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const getpkgjson = require(`get-package-json-from-github`)
const parseGHUrl = require(`parse-github-url`)
const { GraphQLClient } = require(`graphql-request`)

let ecosystemFeaturedItems

require(`dotenv`).config({
path: `.env.${process.env.NODE_ENV}`,
})
Expand Down Expand Up @@ -142,91 +144,97 @@ exports.createPages = ({ graphql, actions }) => {
)

// Query for markdown nodes to use in creating pages.
graphql(
`
query {
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] }
limit: 10000
filter: { fileAbsolutePath: { ne: null } }
) {
edges {
node {
fields {
slug
package
}
frontmatter {
title
draft
canonicalLink
publishedAt
tags
}
graphql(`
query {
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] }
limit: 10000
filter: { fileAbsolutePath: { ne: null } }
) {
edges {
node {
fields {
slug
package
}
frontmatter {
title
draft
canonicalLink
publishedAt
tags
}
}
}
allAuthorYaml {
edges {
node {
fields {
slug
}
}
allAuthorYaml {
edges {
node {
fields {
slug
}
}
}
allCreatorsYaml {
edges {
node {
fields {
slug
}
}
allCreatorsYaml {
edges {
node {
fields {
slug
}
}
}
allSitesYaml(filter: { main_url: { ne: null } }) {
edges {
node {
fields {
slug
}
}
allSitesYaml(filter: { main_url: { ne: null } }) {
edges {
node {
fields {
slug
}
}
}
allStartersYaml {
edges {
node {
id
fields {
starterShowcase {
slug
stub
}
}
allStartersYaml {
edges {
node {
id
fields {
starterShowcase {
slug
stub
}
url
repo
}
url
repo
}
}
allNpmPackage {
edges {
node {
}
allNpmPackage {
edges {
node {
id
title
slug
readme {
id
title
slug
readme {
childMarkdownRemark {
id
childMarkdownRemark {
id
html
}
html
}
}
}
}
}
`
).then(result => {
allEcosystemYaml {
edges {
node {
starters
plugins
}
}
}
}
`).then(result => {
if (result.errors) {
return reject(result.errors)
}
Expand Down Expand Up @@ -393,6 +401,9 @@ exports.createPages = ({ graphql, actions }) => {
}
})

// Read featured starters and plugins for Ecosystem
ecosystemFeaturedItems = result.data.allEcosystemYaml.edges[0].node

return resolve()
})
})
Expand Down Expand Up @@ -592,6 +603,20 @@ exports.onCreateNode = ({ node, actions, getNode, reporter }) => {
// end Community/Creators Pages
}

exports.onCreatePage = ({ page, actions }) => {
// add lists of featured items to Ecosystem page
if (page.path === "/ecosystem/") {
const { createPage, deletePage } = actions
const oldPage = Object.assign({}, page)

page.context.featuredStarters = ecosystemFeaturedItems.starters
page.context.featuredPlugins = ecosystemFeaturedItems.plugins

deletePage(oldPage)
createPage(page)
}
}

exports.onPostBuild = () => {
fs.copySync(
`../docs/blog/2017-02-21-1-0-progress-update-where-came-from-where-going/gatsbygram.mp4`,
Expand Down
4 changes: 4 additions & 0 deletions www/src/assets/ecosystem-icons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import PluginsIcon from "!raw-loader!./plugins-ecosystem.svg"
import StartersIcon from "!raw-loader!./starters.svg"

export { PluginsIcon, StartersIcon }
36 changes: 36 additions & 0 deletions www/src/assets/plugins-ecosystem.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions www/src/assets/starters.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions www/src/components/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Button = ({
tag,
large,
small,
tiny,
secondary,
...rest
}) => {
Expand All @@ -31,9 +32,10 @@ const Button = ({
"&&": {
...buttonStyles.default,
...overrideCSS,
...(secondary && { ...buttonStyles.secondary }),
...(large && { ...buttonStyles.large }),
...(small && { ...buttonStyles.small }),
...(secondary && buttonStyles.secondary),
...(large && buttonStyles.large),
...(small && buttonStyles.small),
...(tiny && buttonStyles.tiny),
},
}

Expand Down
73 changes: 73 additions & 0 deletions www/src/components/ecosystem/ecosystem-board.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import React from "react"
import PropTypes from "prop-types"
import styled from "react-emotion"

import EcosystemSection from "./ecosystem-section"

import presets, { colors } from "../../utils/presets"

const EcosystemBoardRoot = styled("div")`
display: flex;
flex-direction: column;
${presets.Tablet} {
flex-direction: row;
flex-wrap: wrap;
height: calc(
100vh - (${presets.bannerHeight} + ${presets.headerHeight} + 1px)
);
padding: 2rem 1rem 1rem;
}
`

const EcosystemBoard = ({
icons: { plugins: PluginsIcon, starters: StartersIcon },
starters,
plugins,
background,
}) => {
return (
<EcosystemBoardRoot>
<EcosystemSection
title="Plugins"
description="With 429 plugins, lorem ipsum sunt we need some proper copy here pulling in data from your favorite source is only a few mouseclicks away."
subTitle="Featured Plugins"
icon={PluginsIcon}
links={[
{ label: "Browse Plugins", to: "/plugins/" },
{
label: "Plugin Authoring",
to: "/docs/plugin-authoring/",
secondary: true,
},
{ label: "Plugin Docs", to: "/docs/plugins/", secondary: true },
]}
featuredItems={plugins}
/>
<EcosystemSection
title="Starters"
description="Starters are boilerplate Gatsby sites maintained by the community which give you a headstart for your Gatsby project."
subTitle="Featured Starters"
icon={StartersIcon}
links={[
{ label: "Browse Starters", to: "/starters/" },
{ label: "Starter Docs", to: "/docs/starters/", secondary: true },
]}
featuredItems={starters}
/>
<EcosystemSection
title="External Resources"
description="More awesome Gatsby content, created by the community."
links={[{ label: "Browse Resources", to: "/docs/awesome-gatsby/" }]}
/>
</EcosystemBoardRoot>
)
}

EcosystemBoard.propTypes = {
icons: PropTypes.object,
starters: PropTypes.array,
plugins: PropTypes.array,
}

export default EcosystemBoard
Loading

0 comments on commit 2328094

Please sign in to comment.