Merge pull request #144 from sanketmaru/master

Enforce Order of languages in Resources List
This commit is contained in:
Jean-Philippe Sirois
2019-10-12 11:06:09 -04:00
committed by GitHub
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -54,10 +54,11 @@ const Language = memo(({ item }: { item: IFolder; index: number }) => {
export const ResourcesList: FC<HTMLAttributes<HTMLDivElement>> = props => { export const ResourcesList: FC<HTMLAttributes<HTMLDivElement>> = props => {
const resources = useStaticQuery<IAllResourcesQuery>(ALL_RESOURCES) const resources = useStaticQuery<IAllResourcesQuery>(ALL_RESOURCES)
const tree = useBuildTree(resources) const tree = useBuildTree(resources)
const sortedTree = tree.sort((a, b) => a.title.localeCompare(b.title));
return ( return (
<SC.ResourcesListWrapper {...props}> <SC.ResourcesListWrapper {...props}>
{tree.map((node, index) => plantTree(node, index))} {sortedTree.map((node, index) => plantTree(node, index))}
</SC.ResourcesListWrapper> </SC.ResourcesListWrapper>
) )
} }
+2 -1
View File
@@ -98,6 +98,7 @@ const MenuItem: FC<IMenuItemProps> = ({ children, to }) => {
export const ResourcesSidebar: FC<HTMLAttributes<HTMLDivElement>> = props => { export const ResourcesSidebar: FC<HTMLAttributes<HTMLDivElement>> = props => {
const resources = useStaticQuery<IAllResourcesQuery>(ALL_RESOURCES) const resources = useStaticQuery<IAllResourcesQuery>(ALL_RESOURCES)
const tree = useBuildTree(resources) const tree = useBuildTree(resources)
const sortedTree = tree.sort((a, b) => a.title.localeCompare(b.title));
return ( return (
<SC.ResourcesSidebarWrapper {...props}> <SC.ResourcesSidebarWrapper {...props}>
@@ -106,7 +107,7 @@ export const ResourcesSidebar: FC<HTMLAttributes<HTMLDivElement>> = props => {
<Banner /> <Banner />
</Link> </Link>
<SC.Inner> <SC.Inner>
{tree.map((node, index) => plantTree(node, index, true))} {sortedTree.map((node, index) => plantTree(node, index, true))}
<SC.Menu> <SC.Menu>
<MenuItem to="/about">about</MenuItem> <MenuItem to="/about">about</MenuItem>