mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 17:25:59 +02:00
chore: rename docs to resources
This commit is contained in:
@@ -23,7 +23,7 @@ export function Header() {
|
||||
<MenuItem to="/">rules</MenuItem>
|
||||
<MenuItem to="/">faq</MenuItem>
|
||||
<MenuItem to="/">hotbot</MenuItem>
|
||||
<MenuItem to="/docs">documentation</MenuItem>
|
||||
<MenuItem to="/resources">resources</MenuItem>
|
||||
<MenuItem to="/">tech spotlight</MenuItem>
|
||||
</SC.Menu>
|
||||
</SC.InnerWrapper>
|
||||
|
||||
@@ -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<{}>) {
|
||||
<div>
|
||||
<GlobalStyles />
|
||||
<SC.Main>
|
||||
<DocsSidebar />
|
||||
<ResourcesSidebar />
|
||||
<SC.MainContent>
|
||||
<h1>{data.site.siteMetadata.title}</h1>
|
||||
{children}
|
||||
@@ -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<IAllDocsQuery>(ALL_DOCS)
|
||||
const tree = useBuildTree(docs)
|
||||
export function ResourcesSidebar() {
|
||||
const resources = useStaticQuery<IAllResourcesQuery>(ALL_RESOURCES)
|
||||
const tree = useBuildTree(resources)
|
||||
|
||||
return (
|
||||
<SC.DocsSidebarWrapper>
|
||||
<SC.ResourcesSidebarWrapper>
|
||||
{tree.map(node => plantTree(node))}
|
||||
</SC.DocsSidebarWrapper>
|
||||
</SC.ResourcesSidebarWrapper>
|
||||
)
|
||||
}
|
||||
@@ -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;
|
||||
+4
-4
@@ -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("/"))
|
||||
)
|
||||
|
||||
+3
-3
@@ -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<DocsSidebarSectionProps>) {
|
||||
}: PropsWithChildren<ResourcesSidebarSectionProps>) {
|
||||
return (
|
||||
<div>
|
||||
<SC.SidebarTitle>{title}</SC.SidebarTitle>
|
||||
Reference in New Issue
Block a user