diff --git a/README.md b/README.md index c99da5f..3918254 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The official website for [The Programmer's Hangout](https://discord.gg/programmi The site is built with [Gatsby](https://github.com/gatsbyjs/gatsby) which is used to leverage the power of React while allowing for static asset generation along with improved SEO. -**This site and docs is still a work-in-progress and subject to change** +**This site and resources is still a work-in-progress and subject to change** ### Setup @@ -29,7 +29,7 @@ allowing for static asset generation along with improved SEO. If you're not familiar with Gatsby or React, you can still contribute by adding resources for languages you _are_ familiar with. -The list of resources can be found [here](/src/content/docs) +The list of resources can be found [here](/src/content/resources) #### Adding a new resource @@ -63,4 +63,4 @@ external_resources: some content here ``` -You can look at other resources like [this one](/src/content/docs/javascript/promises/intro.md) for reference when creating your own. We use [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) as the date format to confuse both Americans and Europeans an equal amount. +You can look at other resources like [this one](/src/content/resources/javascript/promises/intro.md) for reference when creating your own. We use [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) as the date format to confuse both Americans and Europeans an equal amount. diff --git a/gatsby-config.js b/gatsby-config.js index a4153de..1c98cb4 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -44,8 +44,8 @@ module.exports = { { resolve: `gatsby-source-filesystem`, options: { - name: `docs`, - path: `${__dirname}/src/content/docs`, + name: `resources`, + path: `${__dirname}/src/content/resources`, }, }, `gatsby-transformer-sharp`, diff --git a/gatsby-node.js b/gatsby-node.js index 307e7e4..b33000d 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -26,12 +26,12 @@ const validateResourceArticle = node => { } } -const createDocs = async ({ createPage, graphql }) => { - const languageDocs = path.resolve(`src/templates/languagePost.tsx`) +const createResources = async ({ createPage, graphql }) => { + const languageResources = path.resolve(`src/templates/languagePost.tsx`) const result = await graphql(` - query FetchDocs { - allFile(filter: { sourceInstanceName: { eq: "docs" } }) { + query FetchResources { + allFile(filter: { sourceInstanceName: { eq: "resources" } }) { edges { node { relativePath @@ -47,8 +47,8 @@ const createDocs = async ({ createPage, graphql }) => { return result.data.allFile.edges.forEach(({ node }) => { createPage({ - path: path.join("docs", node.relativePath), - component: languageDocs, + path: path.join("resources", node.relativePath), + component: languageResources, context: { file: node.relativePath, }, @@ -78,5 +78,5 @@ exports.onCreateNode = async ({ node, getNode, actions }) => { exports.createPages = ({ actions, graphql }) => { const { createPage } = actions - return createDocs({ createPage, graphql }) + return createResources({ createPage, graphql }) } diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index aebd2b4..3b72bf0 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -23,7 +23,7 @@ export function Header() { rules faq hotbot - documentation + resources tech spotlight diff --git a/src/components/DocsLayout/index.tsx b/src/components/ResourcesLayout/index.tsx similarity index 82% rename from src/components/DocsLayout/index.tsx rename to src/components/ResourcesLayout/index.tsx index edf4529..97298bb 100644 --- a/src/components/DocsLayout/index.tsx +++ b/src/components/ResourcesLayout/index.tsx @@ -9,11 +9,11 @@ import React, { PropsWithChildren } from "react" import { useStaticQuery, graphql } from "gatsby" import { GlobalStyles } from "../../globalStyles" -import { DocsSidebar } from "../DocsSidebar" +import { ResourcesSidebar } from "../ResourcesSidebar" import { Footer } from "../Footer" import * as SC from "./styles" -export function DocsLayout({ children }: PropsWithChildren<{}>) { +export function ResourcesLayout({ children }: PropsWithChildren<{}>) { const data = useStaticQuery(graphql` query { site { @@ -28,7 +28,7 @@ export function DocsLayout({ children }: PropsWithChildren<{}>) {
- +

{data.site.siteMetadata.title}

{children} diff --git a/src/components/DocsLayout/styles.tsx b/src/components/ResourcesLayout/styles.tsx similarity index 100% rename from src/components/DocsLayout/styles.tsx rename to src/components/ResourcesLayout/styles.tsx diff --git a/src/components/DocsSidebar/index.tsx b/src/components/ResourcesSidebar/index.tsx similarity index 81% rename from src/components/DocsSidebar/index.tsx rename to src/components/ResourcesSidebar/index.tsx index 7dcab99..822b8b9 100644 --- a/src/components/DocsSidebar/index.tsx +++ b/src/components/ResourcesSidebar/index.tsx @@ -31,15 +31,15 @@ export interface IFileQuery { } } -export interface IAllDocsQuery { +export interface IAllResourcesQuery { allFile: { edges: IFileQuery[] } } -const ALL_DOCS = graphql` +const ALL_RESOURCES = graphql` query { - allFile(filter: { sourceInstanceName: { eq: "docs" } }) { + allFile(filter: { sourceInstanceName: { eq: "resources" } }) { edges { node { relativePath @@ -85,13 +85,13 @@ function Folder({ item }: { item: IFolder }) { ) } -export function DocsSidebar() { - const docs = useStaticQuery(ALL_DOCS) - const tree = useBuildTree(docs) +export function ResourcesSidebar() { + const resources = useStaticQuery(ALL_RESOURCES) + const tree = useBuildTree(resources) return ( - + {tree.map(node => plantTree(node))} - + ) } diff --git a/src/components/DocsSidebar/styles.tsx b/src/components/ResourcesSidebar/styles.tsx similarity index 84% rename from src/components/DocsSidebar/styles.tsx rename to src/components/ResourcesSidebar/styles.tsx index ea98111..b3f0716 100644 --- a/src/components/DocsSidebar/styles.tsx +++ b/src/components/ResourcesSidebar/styles.tsx @@ -1,7 +1,7 @@ import styled from "styled-components" import { Link } from "gatsby" -export const DocsSidebarWrapper = styled.div` +export const ResourcesSidebarWrapper = styled.div` box-sizing: border-box; padding: 0 16px; flex: 0 0 300px; diff --git a/src/components/DocsSidebar/useBuildTree.tsx b/src/components/ResourcesSidebar/useBuildTree.tsx similarity index 88% rename from src/components/DocsSidebar/useBuildTree.tsx rename to src/components/ResourcesSidebar/useBuildTree.tsx index 6e43a62..7108fe8 100644 --- a/src/components/DocsSidebar/useBuildTree.tsx +++ b/src/components/ResourcesSidebar/useBuildTree.tsx @@ -5,13 +5,13 @@ import { IFileOrFolder, IFile, IFolder, - IAllDocsQuery, + IAllResourcesQuery, IFileQuery, } from "./index" function traverse( [head, ...tail]: string[], - basePath = "/docs" + basePath = "/resources" ): IFileOrFolder { const path = basePath + "/" + head const isFile = !tail.length @@ -83,8 +83,8 @@ function join([head, ...tail]: IFileOrFolder[]): IFileOrFolder[] { return [current, ...join(remaining)] } -export default function useBuildTree(docs: IAllDocsQuery) { - const objects = docs.allFile.edges.map(({ node: file }: IFileQuery) => +export default function useBuildTree(resources: IAllResourcesQuery) { + const objects = resources.allFile.edges.map(({ node: file }: IFileQuery) => traverse(file.relativePath.split("/")) ) diff --git a/src/components/DocsSidebarSection/index.tsx b/src/components/ResourcesSidebarSection/index.tsx similarity index 61% rename from src/components/DocsSidebarSection/index.tsx rename to src/components/ResourcesSidebarSection/index.tsx index 8396c06..e9298a3 100644 --- a/src/components/DocsSidebarSection/index.tsx +++ b/src/components/ResourcesSidebarSection/index.tsx @@ -1,14 +1,14 @@ import React, { PropsWithChildren } from "react" import * as SC from "./styles" -export interface DocsSidebarSectionProps { +export interface ResourcesSidebarSectionProps { readonly title: string } -export function DocsSidebarSection({ +export function ResourcesSidebarSection({ title, children, -}: PropsWithChildren) { +}: PropsWithChildren) { return (
{title} diff --git a/src/components/DocsSidebarSection/styles.tsx b/src/components/ResourcesSidebarSection/styles.tsx similarity index 100% rename from src/components/DocsSidebarSection/styles.tsx rename to src/components/ResourcesSidebarSection/styles.tsx diff --git a/src/content/docs/javascript/callbacks/intro.md b/src/content/resources/javascript/callbacks/intro.md similarity index 100% rename from src/content/docs/javascript/callbacks/intro.md rename to src/content/resources/javascript/callbacks/intro.md diff --git a/src/content/docs/javascript/iterative-vs-functional.md b/src/content/resources/javascript/iterative-vs-functional.md similarity index 100% rename from src/content/docs/javascript/iterative-vs-functional.md rename to src/content/resources/javascript/iterative-vs-functional.md diff --git a/src/content/docs/javascript/promises/intro.md b/src/content/resources/javascript/promises/intro.md similarity index 100% rename from src/content/docs/javascript/promises/intro.md rename to src/content/resources/javascript/promises/intro.md diff --git a/src/content/docs/javascript/promises/simplifying-promises.md b/src/content/resources/javascript/promises/simplifying-promises.md similarity index 100% rename from src/content/docs/javascript/promises/simplifying-promises.md rename to src/content/resources/javascript/promises/simplifying-promises.md diff --git a/src/content/docs/php/design-patterns/singleton.md b/src/content/resources/php/design-patterns/singleton.md similarity index 100% rename from src/content/docs/php/design-patterns/singleton.md rename to src/content/resources/php/design-patterns/singleton.md diff --git a/src/content/docs/python/basics.md b/src/content/resources/python/basics.md similarity index 100% rename from src/content/docs/python/basics.md rename to src/content/resources/python/basics.md diff --git a/src/pages/docs.tsx b/src/pages/docs.tsx deleted file mode 100644 index d7e9399..0000000 --- a/src/pages/docs.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from "react" - -import { DocsLayout } from "../components/DocsLayout" -import { SEO } from "../components/SEO" - -function DocsPage() { - return ( - - - the docs - - ) -} - -export default DocsPage diff --git a/src/pages/resources.tsx b/src/pages/resources.tsx new file mode 100644 index 0000000..36c62be --- /dev/null +++ b/src/pages/resources.tsx @@ -0,0 +1,15 @@ +import React from "react" + +import { ResourcesLayout } from "../components/ResourcesLayout" +import { SEO } from "../components/SEO" + +function ResourcesPage() { + return ( + + + the resources + + ) +} + +export default ResourcesPage diff --git a/src/templates/languagePost.tsx b/src/templates/languagePost.tsx index 599af62..0f0ef2c 100644 --- a/src/templates/languagePost.tsx +++ b/src/templates/languagePost.tsx @@ -2,17 +2,17 @@ import React from "react" import { graphql } from "gatsby" import { Markdown } from "../components/Markdown" import { SEO } from "../components/SEO" -import { DocsLayout } from "../components/DocsLayout" +import { ResourcesLayout } from "../components/ResourcesLayout" // @todo maybe find alternative type for data function LanguagePost({ data }: any) { const { html, frontmatter } = data.file.post console.log(data) return ( - + - + ) }