diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/EventNavigation.astro | 54 | ||||
| -rw-r--r-- | src/components/PostNavigation.astro | 12 | ||||
| -rw-r--r-- | src/pages/blog/[...id].astro | 4 | ||||
| -rw-r--r-- | src/pages/events/[...id].astro | 9 |
4 files changed, 14 insertions, 65 deletions
diff --git a/src/components/EventNavigation.astro b/src/components/EventNavigation.astro deleted file mode 100644 index f1b76ce..0000000 --- a/src/components/EventNavigation.astro +++ /dev/null @@ -1,54 +0,0 @@ ---- -import Link from '@/components/Link.astro' -import { buttonVariants } from '@/components/ui/button' -import { cn } from '@/lib/utils' -import { Icon } from 'astro-icon/components' - -const { newerEvent, olderEvent } = Astro.props ---- - -<nav class={cn('col-start-2 grid grid-cols-1 gap-4', 'sm:grid-cols-2')}> - <Link - href={olderEvent ? `/events/${olderEvent.id}#event-title` : '#'} - class={cn( - buttonVariants({ variant: 'outline' }), - 'rounded-lg group flex items-center justify-start size-full', - !olderEvent && 'pointer-events-none opacity-50 cursor-not-allowed', - )} - aria-disabled={!olderEvent} - > - <Icon - name="lucide:arrow-left" - class="mr-2 size-4 transition-transform group-hover:-translate-x-1" - /> - <div class="flex flex-col items-start overflow-hidden text-wrap"> - <span class="text-muted-foreground text-left text-xs"> - Previous Event - </span> - <span class="w-full text-left text-sm text-balance text-ellipsis"> - {olderEvent?.data.title || "You're at the oldest event!"} - </span> - </div> - </Link> - - <Link - href={newerEvent ? `/events/${newerEvent.id}#event-title` : '#'} - class={cn( - buttonVariants({ variant: 'outline' }), - 'rounded-lg group flex items-center justify-end size-full', - !newerEvent && 'pointer-events-none opacity-50 cursor-not-allowed', - )} - aria-disabled={!newerEvent} - > - <div class="flex flex-col items-end overflow-hidden text-wrap"> - <span class="text-muted-foreground text-right text-xs"> Next Event </span> - <span class="w-full text-right text-sm text-balance text-ellipsis"> - {newerEvent?.data.title || "You're at the newest event!"} - </span> - </div> - <Icon - name="lucide:arrow-right" - class="ml-2 size-4 transition-transform group-hover:translate-x-1" - /> - </Link> -</nav> diff --git a/src/components/PostNavigation.astro b/src/components/PostNavigation.astro index 8dc2db5..bca228a 100644 --- a/src/components/PostNavigation.astro +++ b/src/components/PostNavigation.astro @@ -4,7 +4,7 @@ import { buttonVariants } from '@/components/ui/button' import { cn } from '@/lib/utils' import { Icon } from 'astro-icon/components' -const { newerPost, olderPost, parentPost } = Astro.props +const { newerPost, olderPost, parentPost, baseURL } = Astro.props const isSubpost = !!parentPost --- @@ -15,11 +15,11 @@ const isSubpost = !!parentPost )} > <Link - href={olderPost ? `/blog/${olderPost.id}#post-title` : '#'} + href={olderPost ? `${baseURL}${olderPost.id}#post-title` : '#'} class={cn( buttonVariants({ variant: 'outline' }), 'rounded-lg group flex items-center justify-start size-full', - !olderPost && 'pointer-events-none opacity-50 cursor-not-allowed', + !olderPost && 'pointer-events-none opacity-0 cursor-not-allowed', )} aria-disabled={!olderPost} > @@ -43,7 +43,7 @@ const isSubpost = !!parentPost { isSubpost && ( <Link - href={parentPost ? `/blog/${parentPost.id}#post-title` : '#'} + href={parentPost ? `${baseURL}${parentPost.id}#post-title` : '#'} class={cn( buttonVariants({ variant: 'outline' }), 'group flex size-full items-center justify-center rounded-lg', @@ -67,11 +67,11 @@ const isSubpost = !!parentPost } <Link - href={newerPost ? `/blog/${newerPost.id}#post-title` : '#'} + href={newerPost ? `${baseURL}${newerPost.id}#post-title` : '#'} class={cn( buttonVariants({ variant: 'outline' }), 'rounded-lg group flex items-center justify-end size-full', - !newerPost && 'pointer-events-none opacity-50 cursor-not-allowed', + !newerPost && 'pointer-events-none opacity-0 cursor-not-allowed', )} aria-disabled={!newerPost} > diff --git a/src/pages/blog/[...id].astro b/src/pages/blog/[...id].astro index 5cc9eab..d4588e3 100644 --- a/src/pages/blog/[...id].astro +++ b/src/pages/blog/[...id].astro @@ -213,6 +213,7 @@ const tocSections = await getTOCSections(currentPostId) <PostNavigation newerPost={navigation.newer} olderPost={navigation.older} + baseURL="/blog/" parentPost={isCurrentSubpost ? navigation.parent : undefined} /> </section> @@ -241,6 +242,7 @@ const tocSections = await getTOCSections(currentPostId) <PostNavigation newerPost={navigation.newer} olderPost={navigation.older} + path="blog" parentPost={isCurrentSubpost ? navigation.parent : undefined} /> </section> @@ -296,4 +298,4 @@ const tocSections = await getTOCSections(currentPostId) document.addEventListener('astro:page-load', ensureKatexStyles) document.addEventListener('astro:after-swap', ensureKatexStyles) -</script>
\ No newline at end of file +</script> diff --git a/src/pages/events/[...id].astro b/src/pages/events/[...id].astro index 590a5c6..4c9665e 100644 --- a/src/pages/events/[...id].astro +++ b/src/pages/events/[...id].astro @@ -1,6 +1,6 @@ --- import Breadcrumbs from '@/components/Breadcrumbs.astro' -import EventNavigation from '@/components/EventNavigation.astro' +import PostNavigation from '@/components/PostNavigation.astro' import TOCHeader from '@/components/TOCHeader.astro' import TOCSidebar from '@/components/TOCSidebar.astro' import { badgeVariants } from '@/components/ui/badge' @@ -116,9 +116,10 @@ const tocSections = await getTOCSections(currentEventId) <Content /> </article> - <EventNavigation - newerEvent={navigation.newer} - olderEvent={navigation.older} + <PostNavigation + newerPost={navigation.newer} + olderPost={navigation.older} + baseURL="/events/" /> </section> |
