File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,30 +29,37 @@ const projects = (await getCollection('work'))
2929 .sort ((a , b ) => b .data .pubDate .valueOf () - a .data .pubDate .valueOf ());
3030
3131const currentIndex = projects .findIndex ((item ) => item .id === entry .id );
32- const prevEntry = projects [currentIndex - 1 ];
33- const nextEntry = projects [currentIndex + 1 ];
32+ const prevEntry = projects [( currentIndex - 1 + projects . length ) % projects . length ];
33+ const nextEntry = projects [( currentIndex + 1 ) % projects . length ];
3434---
3535
3636<BaseLayout {... entry .data }>
3737 <div class =" grid-cols-12 lg:grid" >
3838 <div class =" col-span-3" >
3939 <div class =" sticky top-12" >
4040 <!-- Previous / Next arrows -->
41- <div class =" mb-6 flex gap-4 " >
41+ <div class =" mb-7 flex items-center gap-2 " >
4242 {
4343 prevEntry && (
4444 <a
4545 href = { ` /work/${prevEntry .id } ` }
4646 aria-label = " Previous"
47- class = " px-3 py-2 dark:text-white"
47+ class = " py-1 pr-3 pl-1 opacity-60 transition-opacity hover:opacity-100 dark:text-white"
4848 >
4949 <Icon name = " arrow-left" size = { 20 } />
5050 </a >
5151 )
5252 }
53+ <span class =" w-12 text-center opacity-60" >
54+ { ` ${currentIndex + 1 } / ${projects .length } ` }
55+ </span >
5356 {
5457 nextEntry && (
55- <a href = { ` /work/${nextEntry .id } ` } aria-label = " Next" class = " px-3 py-2 dark:text-white" >
58+ <a
59+ href = { ` /work/${nextEntry .id } ` }
60+ aria-label = " Next"
61+ class = " px-3 py-1 opacity-60 transition-opacity hover:opacity-100 dark:text-white"
62+ >
5663 <Icon name = " arrow-right" size = { 20 } />
5764 </a >
5865 )
You can’t perform that action at this time.
0 commit comments