From ccaf70ef32105b434ece3ab9d4d5de8b91de1dce Mon Sep 17 00:00:00 2001 From: Radomir Skrzepij Date: Sun, 21 Jul 2019 22:04:27 +0200 Subject: [PATCH 1/2] move 'replaceSpacesWithDashes' method do utils file (different for node); add some simple footer component --- gatsby-node.js | 3 ++- src/components/footer.js | 29 +++++++++++++++++++++++++++++ src/pages/index.js | 3 +++ src/templates/allCategoriesIndex.js | 3 ++- src/utils/node.utils.js | 3 +++ src/utils/string.utils.js | 3 +++ 6 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/components/footer.js create mode 100644 src/utils/node.utils.js create mode 100644 src/utils/string.utils.js diff --git a/gatsby-node.js b/gatsby-node.js index 73c5185..f6a5234 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,3 +1,4 @@ +const nodeUtilsModule = require("./src/utils/node.utils") const path = require("path") /** @@ -37,7 +38,7 @@ const createCategoryPages = (createPage, posts) => { categories.forEach(categoryName => { const posts = postsByCategory[categoryName] - const categoryWithDashes = categoryName.replace(/\s+/g, '-').toLowerCase() + const categoryWithDashes = nodeUtilsModule.replaceSpacesWithDashes(categoryName) createPage({ path: `/categories/${ categoryWithDashes }`, diff --git a/src/components/footer.js b/src/components/footer.js new file mode 100644 index 0000000..9216ce8 --- /dev/null +++ b/src/components/footer.js @@ -0,0 +1,29 @@ +import { graphql, Link, StaticQuery } from "gatsby" +import React from "react" + +const TitleAndDescription = ({ data }) => { + const siteTitle = data.site.siteMetadata.title + const siteDescritpion = data.site.siteMetadata.description + + return ( +
+

+ { siteTitle } +

+

{ siteDescritpion }

+
+ ) +} + +const Footer = () => { + return ( + + ) +} + +export default Footer diff --git a/src/pages/index.js b/src/pages/index.js index 2da1ec0..003112a 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -3,6 +3,7 @@ import SEO from "../components/seo" import Header from "../components/header" import { graphql } from "gatsby" import { Link } from "@reach/router" +import Footer from "../components/footer" // TODO: Implement properly Layout component // https://trello.com/c/ZN2twpaz @@ -44,6 +45,8 @@ const IndexPage = ({ data }) => {
Przeglądaj kategorie
+ +