Files
pocket-id/frontend/src/lib/components/ui/pagination/pagination-link.svelte
T

43 lines
888 B
Svelte

<script lang="ts">
import { Pagination as PaginationPrimitive } from 'bits-ui';
import { cn } from '#lib/utils/style.js';
import { buttonVariants, type ButtonSize } from '#lib/components/ui/button/index.js';
let {
ref = $bindable(null),
class: className,
size = 'icon-sm',
isActive,
page,
children,
...restProps
}: PaginationPrimitive.PageProps & {
size?: ButtonSize;
isActive: boolean;
} = $props();
</script>
{#snippet Fallback()}
{page.value}
{/snippet}
<PaginationPrimitive.Page
bind:ref
{page}
aria-current={isActive ? 'page' : undefined}
data-slot="pagination-link"
data-active={isActive}
data-size={size}
class={cn(
buttonVariants({ size, variant: isActive ? 'secondary' : 'ghost' }),
'tabular-nums',
className
)}
{...restProps}
>
{#if children}
{@render children?.()}
{:else}
{@render Fallback()}
{/if}
</PaginationPrimitive.Page>