Commit e65dcebf authored by alain's avatar alain 🐙
Browse files

update frontend dependencies, add templates

parent ddadec49
......@@ -32,6 +32,7 @@ module.exports = {
'domain',
'use-case',
'alternative',
'article'
],
singleTypes: [
'header',
......@@ -39,6 +40,7 @@ module.exports = {
'domains-page',
'practice-page',
'about',
'deps-page'
],
queryLimit: 1000
}
......@@ -50,7 +52,7 @@ module.exports = {
options: {
// Available options and their defaults:
base64Width: 20,
forceBase64Format: ``, // valid formats: png,jpg,webp
forceBase64Format: `png`, // valid formats: png,jpg,webp
useMozJpeg: process.env.GATSBY_JPEG_ENCODER === `MOZJPEG`,
stripMetadata: true,
defaultQuality: 60,
......
......@@ -41,6 +41,14 @@ exports.createPages = ({ actions, graphql }) => {
}
}
}
allStrapiArticle {
edges {
node {
id
slug
}
}
}
}
`).then(result => {
result.data.allStrapiDomain.edges.forEach(({ node }) => {
......@@ -61,7 +69,15 @@ exports.createPages = ({ actions, graphql }) => {
},
})
})
result.data.allStrapiArticle.edges.forEach(({ node }) => {
createPage({
path: `/articles/${node.slug}`,
component: path.resolve(`src/templates/article.js`),
context: {
id: node.id,
},
})
})
});
......
......@@ -5,29 +5,30 @@
"version": "0.1.0",
"author": "Alain Otjens <alain@waag.org>",
"dependencies": {
"gatsby": "^2.24.47",
"gatsby-cli": "^2.12.87",
"gatsby-image": "^2.4.16",
"gatsby-plugin-manifest": "^2.4.23",
"gatsby-plugin-offline": "^3.2.23",
"gatsby-plugin-react-helmet": "^3.3.6",
"babel-preset-gatsby": "^1.0.0",
"gatsby": "^3.0.2",
"gatsby-cli": "^3.0.0",
"gatsby-image": "^3.0.0",
"gatsby-plugin-manifest": "^3.0.0",
"gatsby-plugin-offline": "^4.0.0",
"gatsby-plugin-react-helmet": "^4.0.0",
"gatsby-plugin-react-svg": "^3.0.0",
"gatsby-plugin-sass": "^2.3.12",
"gatsby-plugin-sharp": "^2.6.27",
"gatsby-source-filesystem": "^2.3.24",
"gatsby-plugin-sass": "^4.0.1",
"gatsby-plugin-sharp": "^3.0.0",
"gatsby-source-filesystem": "^3.0.0",
"gatsby-source-strapi": "^0.0.12",
"gatsby-transformer-sharp": "^2.5.13",
"gsap": "^3.5.0",
"node-sass": "^4.14.1",
"gatsby-transformer-sharp": "^3.0.0",
"gsap": "^3.6.0",
"node-sass": "^5.0.0",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-helmet": "^6.1.0",
"react-responsive": "^8.1.0",
"text-clipper": "^2.1.0"
},
"devDependencies": {
"prettier": "2.0.5"
"prettier": "2.2.1"
},
"keywords": [
"gatsby"
......
import React from "react"
import { graphql, Link } from "gatsby"
import clip from "text-clipper"
import Layout from "../components/layout"
import SEO from "../components/seo"
const DepsPage = ({ data }) => {
return (
<Layout>
<SEO title="Deps" />
<div className="row">
<h1 className="page-title">Deps</h1>
<h3>{data.strapiDepsPage.subtitle}</h3>
<div dangerouslySetInnerHTML={{ __html: data.strapiDepsPage.introduction }} />
<div className="items">
{ data.allStrapiArticle.nodes.map(node => {
const excerpt = node.excerpt ? node.excerpt : clip(node.body, 150, { html: true })
return (
<div key={node.id} className="item">
<h2><Link to={`/articles/${node.slug}`}>{ node.title }</Link></h2>
<div dangerouslySetInnerHTML={{ __html: excerpt }} />
<Link className="button" to={`/articles/${node.slug}`}>Read more...</Link>
</div>
)
}) }
</div>
</div>
</Layout>
)
}
export default DepsPage
export const pageQuery = graphql`
query ArticlesQuery {
strapiDepsPage {
subtitle
introduction
}
allStrapiArticle {
nodes {
id
slug
title
excerpt
body
}
}
}
`
\ No newline at end of file
import React from 'react'
import { Link, graphql } from 'gatsby'
import Layout from '../components/layout'
const ArticleTemplate = ({ data }) => {
return (
<Layout>
<section>
<div className="row">
<h1>{data.strapiArticle.title}</h1>
<div className="content" dangerouslySetInnerHTML={{ __html:data.strapiArticle.body }} />
<Link to="/deps/" className="back">&laquo; all articles</Link>
</div>
</section>
</Layout>
)
}
export default ArticleTemplate
export const query = graphql`
query ArticleTemplate($id: String!) {
strapiArticle(id: {eq: $id}) {
id
title
body
}
}
`
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment