summaryrefslogblamecommitdiffstatshomepage
path: root/frontend/src/lib/pagination/Target.svelte
blob: 76e0d9ec847d9e197818288a0c395eaf6b73d50e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                  
                                          
                                                   
                                              
 





                                   
 




                                                                                     


         
                 

                                                                                                                                                                                                                                           

                  
                              
         
<script lang="ts">
	import { page } from '$app/state';
	import { navigate } from '$lib/Navigation';
	import type { Snippet } from 'svelte';

	interface Props {
		active?: boolean;
		disabled?: boolean;
		target: number;
		children?: Snippet;
	}

	let { active = false, disabled = false, target, children }: Props = $props();

	function onclick() {
		navigate({ pagination: { page: target } }, page.url.searchParams);
	}
</script>

<button
	{onclick}
	class:active
	class="flex h-8 w-8 items-center justify-center rounded-sm p-0 text-base font-medium hover:bg-slate-700/50 hover:text-white disabled:text-slate-600 disabled:hover:bg-inherit [&.active]:bg-slate-700 [&:not(active)]:bg-slate-800"
	{disabled}
>
	{@render children?.()}
</button>