diff --git a/src/components/PageNavigation/index.tsx b/src/components/PageNavigation/index.tsx index 8d6769d..d3d6505 100644 --- a/src/components/PageNavigation/index.tsx +++ b/src/components/PageNavigation/index.tsx @@ -13,33 +13,25 @@ interface IPageContentProps { export const PageNavigation: FC = ({ previous, next }) => { return ( - - {previous ? ( - + + {previous && ( + Previous - - {previous.title} - + {previous.title} - - ) : ( -
+ )} - {next ? ( - + {next && ( + Next - - {next.title} - + {next.title} - - ) : ( -
+ )} -
+ ) } diff --git a/src/components/PageNavigation/styles.tsx b/src/components/PageNavigation/styles.tsx index 321917c..fa61535 100644 --- a/src/components/PageNavigation/styles.tsx +++ b/src/components/PageNavigation/styles.tsx @@ -3,11 +3,11 @@ import { Link } from "gatsby" import fontFamily from "../../design/typography" import ArrowRight from "../../icons/arrow-right.svg" -export const Content = styled.div` +export const PageNavigationWrapper = styled.div` + margin-top: 64px; display: flex; justify-content: space-between; align-content: center; -} ` export const Text = styled.p` @@ -20,11 +20,6 @@ export const Text = styled.p` export const NavLink = styled(Link)` display: flex; text-decoration: none; - text-align: right; - - & > svg ~ p { - text-align: left; - } &:hover, &:focus { @@ -37,14 +32,18 @@ export const PageContent = styled.div` width: 200px; display: flex; flex-direction: column; +` - &:last-of-type { - align-items: flex-end; - } +export const PreviousPage = styled(PageContent)` + margin-right: auto; +` - & > div { - display: flex; - justify-content: start; +export const NextPage = styled(PageContent)` + margin-left: auto; + + ${Text}, + ${NavLink} { + text-align: right; } ` @@ -58,6 +57,7 @@ export const PageTitle = styled(Text)` export const NextArrow = styled(ArrowRight)` width: 8px; + path { fill: #ff74a2; } @@ -66,6 +66,7 @@ export const NextArrow = styled(ArrowRight)` export const PreviousArrow = styled(ArrowRight)` width: 8px; transform: rotate(180deg); + path { fill: #feac71; } 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 )