From aa623ae9656c12046a697ebc78ff01893fa33297 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Sirois Date: Thu, 1 Oct 2020 16:43:48 -0400 Subject: [PATCH] style: auto-format page navigation --- src/components/PageNavigation/index.tsx | 8 ++------ src/templates/resourcePage.tsx | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/components/PageNavigation/index.tsx b/src/components/PageNavigation/index.tsx index fd14a83..c9b4371 100644 --- a/src/components/PageNavigation/index.tsx +++ b/src/components/PageNavigation/index.tsx @@ -19,9 +19,7 @@ export const PageNavigation: FC = ({ previous, next }) => { Previous - - {previous.title} - + {previous.title} ) : ( @@ -31,9 +29,7 @@ export const PageNavigation: FC = ({ previous, next }) => { Next - - {next.title} - + {next.title} diff --git a/src/templates/resourcePage.tsx b/src/templates/resourcePage.tsx index 4552f67..fb3831d 100644 --- a/src/templates/resourcePage.tsx +++ b/src/templates/resourcePage.tsx @@ -33,15 +33,18 @@ const ResourcePage: FC = ({ data }) => { toc.length ) - const pages = sortWith([ - descend((f: any) => { - if (f.node.relativePath.includes("intro")) { - return 1; - } + const pages = sortWith( + [ + descend((f: any) => { + if (f.node.relativePath.includes("intro")) { + return 1 + } - return -1; - }) - ], data.allFile.edges) + return -1 + }), + ], + data.allFile.edges + ) const currentIndex = pages.findIndex( (x: any) => x.node.relativePath === relativePath )