mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 17:25:59 +02:00
refact: use ramda for sorting
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { graphql, useStaticQuery } from "gatsby"
|
||||
import { descend, sortWith } from "ramda"
|
||||
import { descend, sort, sortWith } from "ramda"
|
||||
import React, { FC, HTMLAttributes, memo, useState } from "react"
|
||||
import TriangleDown from "../../icons/triangle-down.svg"
|
||||
import { IAllResourcesQuery, IFileOrFolder, IFolder } from "../../types"
|
||||
@@ -113,7 +113,7 @@ const FirstLevelFolder = memo(
|
||||
export const ResourcesSidebar: FC<HTMLAttributes<HTMLDivElement>> = props => {
|
||||
const resources = useStaticQuery<IAllResourcesQuery>(ALL_RESOURCES)
|
||||
const tree = useBuildTree(resources, "/resources")
|
||||
const sortedTree = tree.sort((a, b) => a.title.localeCompare(b.title))
|
||||
const sortedTree = sort((a, b) => a.title.localeCompare(b.title), tree)
|
||||
|
||||
return (
|
||||
<Sidebar {...props}>
|
||||
|
||||
Reference in New Issue
Block a user