Rename archive components

This commit is contained in:
Mark
2021-10-24 17:22:23 +01:00
parent 89fa0fd4a9
commit f252e81de2
9 changed files with 25 additions and 25 deletions
@@ -9,7 +9,7 @@ import { humanize } from "../../utils"
import { Sidebar } from "../Sidebar"
import * as SC from "./styles"
const ALL_ARCHIVES = graphql`
const ALL_SPOTLIGHTS = graphql`
query {
spotlights: allFile(
filter: { sourceInstanceName: { eq: "spotlights" } }
@@ -42,9 +42,9 @@ function Tree({ item }: { item: IFileOrFolder }) {
)
}
export const ArchivesSidebar: FC<HTMLAttributes<HTMLDivElement>> = (props) => {
const { archives } = useStaticQuery(ALL_ARCHIVES)
const tree = useBuildTree(archives, "/spotlights")
export const SpotlightsSidebar: FC<HTMLAttributes<HTMLDivElement>> = (props) => {
const { spotlights } = useStaticQuery(ALL_SPOTLIGHTS)
const tree = useBuildTree(spotlights, "/spotlights")
const sortedTree = sort((a, b) => a.title.localeCompare(b.title), tree)
return (
@@ -1,13 +1,13 @@
import React, { FC } from "react"
import { ArchivesSidebar } from "../../components/ArchivesSidebar"
import { SpotlightsSidebar } from "../../components/SpotlightsSidebar"
import { ColumnLayout } from "../ColumnLayout"
export const ArchivesLayout: FC = ({ children }) => {
export const SpotlightsLayout: FC = ({ children }) => {
return (
<ColumnLayout
title="Spotlights"
sidebar={ArchivesSidebar}
sidebar={SpotlightsSidebar}
content={children}
/>
)
+2 -2
View File
@@ -1,7 +1,7 @@
import { WindowLocation } from "@reach/router"
import React, { FC, useMemo } from "react"
import { LocationProvider } from "../LocationProvider"
import { ArchivesLayout } from "./ArchivesLayout"
import { SpotlightsLayout } from "./SpotlightsLayout"
import { HomeLayout } from "./HomeLayout"
import { PageLayout } from "./PageLayout"
import { ResourcesLayout } from "./ResourcesLayout"
@@ -22,7 +22,7 @@ const BaseLayout: FC<IBaseLayout> = (props) => {
case "resources":
return ResourcesLayout
case "spotlights":
return ArchivesLayout
return SpotlightsLayout
case "regular":
return PageLayout
default:
@@ -5,7 +5,7 @@ import { Link } from "../../components/Link"
import { PageContent } from "../../components/PageContent"
import { SEO } from "../../components/SEO"
function ArchivesPage() {
function SpotlightsPage() {
return (
<Fragment>
<SEO title="Tech Spotlights" />
@@ -25,4 +25,4 @@ function ArchivesPage() {
)
}
export default ArchivesPage
export default SpotlightsPage
@@ -7,7 +7,7 @@ import { humanize } from "../utils"
import { PageContent } from "../components/PageContent"
// @todo maybe find alternative type for data
const Archive: FC<any> = ({ data }) => {
const Spotlight: FC<any> = ({ data }) => {
const { relativePath } = data.file
const { body, excerpt, fields, timeToRead, frontmatter } = data.file.post
@@ -30,10 +30,10 @@ const Archive: FC<any> = ({ data }) => {
)
}
export default Archive
export default Spotlight
export const query = graphql`
query Archive($file: String!) {
query Spotlight($file: String!) {
file(relativePath: { eq: $file }) {
relativePath
post: childMdx {
+3 -3
View File
@@ -32,7 +32,7 @@ export interface IFileResourceQuery {
}
}
export interface IFileArchiveQuery {
export interface IFileSpotlightQuery {
node: {
relativePath: string
}
@@ -50,9 +50,9 @@ export interface IAllResourcesQuery extends IAllFilesQuery {
}
}
export interface IAllArchivesQuery extends IAllFilesQuery {
export interface IAllSpotlightsQuery extends IAllFilesQuery {
allFile: {
edges: IFileArchiveQuery[]
edges: IFileSpotlightQuery[]
}
}