<script lang="ts">
    import { onMount } from "svelte";   
    import {urlG} from "../stores/urlStore";

    let {currentPag,
         cantpag,
         queryPag
        }:{
         currentPag: number,
         cantpag: number,
         queryPag: (a:number) => void} = $props();
    
    
    const token = sessionStorage.getItem("token");

    onMount(async () => {

    });
    
    let array = $derived.by(()=> Array.from({ length: cantpag }, (_, i) => i + 1));
</script>

{#if cantpag>1}
<nav aria-label="Page navigation example">
    <ul class="pagination">
        {#each array as num }
        {#if currentPag !== num}
        <li class="page-item"><a class="page-link" href="#" onclick={()=>queryPag(num)}>{String(num)}</a></li>
        {:else}
        <li class="page-item"><a class="page-link active" href="#" onclick={()=>queryPag(num)}>{String(num)}</a></li>
        {/if}
        {/each}
    </ul>
</nav>
{/if}