56 lines
1.8 KiB
Text
56 lines
1.8 KiB
Text
---
|
|
import Link from '@/components/Link.astro'
|
|
import { buttonVariants } from '@/components/ui/button'
|
|
import { cn } from '@/lib/utils'
|
|
import { Icon } from 'astro-icon/components'
|
|
|
|
const { prevPost, nextPost } = Astro.props
|
|
---
|
|
|
|
<div class="col-start-2 flex flex-col gap-4 sm:flex-row">
|
|
<Link
|
|
href={nextPost ? `/blog/${nextPost.slug}` : '#'}
|
|
class={cn(
|
|
buttonVariants({ variant: 'outline' }),
|
|
'rounded-xl group flex items-center justify-start w-full sm:w-1/2 h-fit',
|
|
!nextPost && 'pointer-events-none opacity-50 cursor-not-allowed',
|
|
)}
|
|
aria-disabled={!nextPost}
|
|
>
|
|
<div class="mr-2 flex-shrink-0">
|
|
<Icon
|
|
name="lucide:arrow-left"
|
|
class="size-4 transition-transform group-hover:-translate-x-1"
|
|
/>
|
|
</div>
|
|
<div class="flex flex-col items-start overflow-hidden">
|
|
<span class="text-left text-xs text-muted-foreground">Next Post</span>
|
|
<span class="w-full truncate text-left text-sm"
|
|
>{nextPost?.data.title || 'Latest post!'}</span
|
|
>
|
|
</div>
|
|
</Link>
|
|
<Link
|
|
href={prevPost ? `/blog/${prevPost.slug}` : '#'}
|
|
class={cn(
|
|
buttonVariants({ variant: 'outline' }),
|
|
'rounded-xl group flex items-center justify-end w-full sm:w-1/2 h-fit',
|
|
!prevPost && 'pointer-events-none opacity-50 cursor-not-allowed',
|
|
)}
|
|
aria-disabled={!prevPost}
|
|
>
|
|
<div class="flex flex-col items-end overflow-hidden">
|
|
<span class="text-right text-xs text-muted-foreground">Previous Post</span
|
|
>
|
|
<span class="w-full truncate text-right text-sm"
|
|
>{prevPost?.data.title || 'Last post!'}</span
|
|
>
|
|
</div>
|
|
<div class="ml-2 flex-shrink-0">
|
|
<Icon
|
|
name="lucide:arrow-right"
|
|
class="size-4 transition-transform group-hover:translate-x-1"
|
|
/>
|
|
</div>
|
|
</Link>
|
|
</div>
|