mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 17:25:59 +02:00
refact: extract duplicated File/Folder types
This commit is contained in:
@@ -4,44 +4,12 @@ import Scrollbar from "react-perfect-scrollbar"
|
||||
import "react-perfect-scrollbar/dist/css/styles.css"
|
||||
import TriangleDown from "../../icons/triangle-down.svg"
|
||||
import Banner from "../../images/tph-banner.svg"
|
||||
import { IAllResourcesQuery, IFileOrFolder, IFolder } from "../../types"
|
||||
import { ThemeToggler } from "../ThemeToggler"
|
||||
import useSidebar from "./../../hooks/useSidebar"
|
||||
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" } }) {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import chain from "ramda/es/chain"
|
||||
import partition from "ramda/es/partition"
|
||||
|
||||
import { traversePaths } from "../../utils"
|
||||
import {
|
||||
IAllResourcesQuery,
|
||||
IFile,
|
||||
IFileOrFolder,
|
||||
IFileQuery,
|
||||
IFolder,
|
||||
} from "./index"
|
||||
} from "../../types"
|
||||
import { traversePaths } from "../../utils"
|
||||
|
||||
function generateFolder({
|
||||
title,
|
||||
|
||||
Reference in New Issue
Block a user