Skip to content

Commit 575365a

Browse files
Correct NavButtons Build Error
1 parent 1c6a7e8 commit 575365a

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

components/NavigationButtons.tsx

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,31 @@ export default function NextPrevButton({
6363
<div className='h-auto w-1/2'></div>
6464
)}
6565

66-
<div className='h-auto w-1/2'>
67-
<div className='h-full cursor-pointer rounded border border-gray-200 p-4 text-center shadow-md transition-all duration-300 ease-in-out hover:border-gray-300 hover:shadow-lg dark:shadow-xl dark:drop-shadow-lg dark:hover:shadow-2xl lg:text-right'>
68-
<Link href={nextURL}>
69-
<div className='text-primary dark:text-slate-300 flex flex-row-reverse gap-5 text-[18px]'>
70-
<Image
71-
src={'/icons/arrow.svg'}
72-
height={10}
73-
width={10}
74-
alt='next icon '
75-
className='w-5'
76-
/>
77-
<div className='my-auto inline font-bold uppercase '>Up Next</div>
78-
</div>
79-
<div className='my-2 text-base font-medium text-slate-600 dark:text-slate-300'>
80-
{nextLabel}
81-
</div>
82-
</Link>
66+
{nextURL && nextLabel ? (
67+
<div className='h-auto w-1/2'>
68+
<div className='h-full cursor-pointer rounded border border-gray-200 p-4 text-center shadow-md transition-all duration-300 ease-in-out hover:border-gray-300 hover:shadow-lg dark:shadow-xl dark:drop-shadow-lg dark:hover:shadow-2xl lg:text-right'>
69+
<Link href={nextURL}>
70+
<div className='text-primary dark:text-slate-300 flex flex-row-reverse gap-5 text-[18px]'>
71+
<Image
72+
src={'/icons/arrow.svg'}
73+
height={10}
74+
width={10}
75+
alt='next icon '
76+
className='w-5'
77+
/>
78+
<div className='my-auto inline font-bold uppercase '>
79+
Up Next
80+
</div>
81+
</div>
82+
<div className='my-2 text-base font-medium text-slate-600 dark:text-slate-300'>
83+
{nextLabel}
84+
</div>
85+
</Link>
86+
</div>
8387
</div>
84-
</div>
88+
) : (
89+
<div className='h-auto w-1/2'></div>
90+
)}
8591
</div>
8692
);
8793
}

pages/learn/[slug].page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export default function StaticMarkdownPage({
3333
<Headline1>{frontmatter.title}</Headline1>
3434
<StyledMarkdown markdown={content} />
3535
<NextPrevButton
36-
prevLabel={frontmatter.prev.label}
37-
prevURL={frontmatter.prev.url}
38-
nextLabel={frontmatter.next.label}
39-
nextURL={frontmatter.next.url}
36+
prevLabel={frontmatter?.prev?.label}
37+
prevURL={frontmatter?.prev?.url}
38+
nextLabel={frontmatter?.next?.label}
39+
nextURL={frontmatter?.next?.url}
4040
/>
4141
<DocsHelp markdownFile={markdownFile} />
4242
</SectionContext.Provider>

0 commit comments

Comments
 (0)