1
0
Fork 0

wip(shared): Changes to layouts

This will break the org build, but we need to rip out sanity anyway so
I don't think it's worth obsessing over it now.

I've essentially changes the default layout and added a new navigation
component.
This commit is contained in:
joostdecock 2023-07-15 16:55:22 +02:00
parent 8b79de2bd6
commit 5a9f2f8d40
26 changed files with 318 additions and 172 deletions

View file

@ -31,7 +31,7 @@ const NextPage = ({ t, s }) =>
<span></span>
)
export const PrevNext = ({ slug }) => {
export const PrevNext = ({ slug, noPrev = false }) => {
// Grab site navigation and slug lookup table from the useNavigatin hook
const { siteNav, slugLut } = useNavigation()
@ -42,13 +42,13 @@ export const PrevNext = ({ slug }) => {
const iNext = index === slugLut.length - 1 ? 0 : index + 1
// Subtract 1 for the previous page, unless it's the first page
const iPrev = index === 0 ? slugLut.length - 1 : index - 1
const iPrev = noPrev ? false : index === 0 ? slugLut.length - 1 : index - 1
// Get the next page from the siteNav object
const next = get(siteNav, slugLut[iNext].split('/'))
// Get the previous page from the siteNav object
const prev = get(siteNav, slugLut[iPrev].split('/'))
const prev = noPrev ? false : get(siteNav, slugLut[iPrev].split('/'))
// Return content
return (
@ -58,7 +58,7 @@ export const PrevNext = ({ slug }) => {
'items-start pt-6 mt-6 border-t-2 border-solid border-r-0 border-l-0 border-b-0'
}
>
<PrevPage t={prev.t} s={prev.s} />
{noPrev ? <span /> : <PrevPage t={prev.t} s={prev.s} />}
<NextPage t={next.t} s={next.s} />
</div>
)