Skip to content

web search done right

707 B
Raw Blame
<script lang="ts">
  import { page } from '$app/stores';
  import { twMerge } from 'tailwind-merge';

  export let href: string;
  export let label: string | undefined = void 0;
  export let exact: boolean = false;
  export let round = false;
  export let active = false;

  $: isActive =
    active || (exact ? $page.url.pathname == href : $page.url.pathname.startsWith(href));
</script>

<a
  aria-label={label}
  {href}
  class={twMerge(
    'flex justify-center rounded-full transition',
    round ? 'p-2' : 'px-2 py-1',
    'text-neutral-focus hover:bg-primary-focus/5 hover:text-primary-focus active:bg-primary-focus/5',
    isActive && 'bg-primary-focus/5 text-primary-focus',
  )}
>
  <slot />
</a>