---
import Link from "./Link.astro";

interface Props {
  currentPage: number;
  lastPage: number;
  getPageUrl: (page: number) => string;
}

const { currentPage, lastPage, getPageUrl } = Astro.props;
---

<nav aria-label="Pagination Navigation" class="flex py-6">
  {
    currentPage > 1 && (
      <Link href={getPageUrl(currentPage - 1)}>« Previous</Link>
    )
  }
  {
    currentPage < lastPage && (
      <Link href={getPageUrl(currentPage + 1)} class="ml-auto">
        Next »
      </Link>
    )
  }
</nav>
