mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-07 16:06:12 +02:00
refact: extract duplicated File/Folder types
This commit is contained in:
@@ -1,42 +1,10 @@
|
||||
import { graphql, useStaticQuery } from "gatsby"
|
||||
import React, { memo } from "react"
|
||||
import "react-perfect-scrollbar/dist/css/styles.css"
|
||||
import { IAllResourcesQuery, IFileOrFolder, IFolder } from "../../types"
|
||||
import * as SC from "./styles"
|
||||
import useBuildTree from "./useBuildTree"
|
||||
|
||||
export interface IFile {
|
||||
title: string
|
||||
type: "file"
|
||||
path: string
|
||||
}
|
||||
|
||||
export interface IFolder {
|
||||
title: string
|
||||
type: "folder"
|
||||
path: string
|
||||
children: IFileOrFolder[]
|
||||
}
|
||||
|
||||
export type IFileOrFolder = IFile | IFolder
|
||||
|
||||
export interface IFileQuery {
|
||||
node: {
|
||||
relativePath: string
|
||||
childMarkdownRemark: {
|
||||
frontmatter: {
|
||||
author: string
|
||||
date: string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface IAllResourcesQuery {
|
||||
allFile: {
|
||||
edges: IFileQuery[]
|
||||
}
|
||||
}
|
||||
|
||||
const ALL_RESOURCES = graphql`
|
||||
query {
|
||||
allFile(filter: { sourceInstanceName: { eq: "resources" } }) {
|
||||
|
||||
Reference in New Issue
Block a user