<script lang="ts">
  import { getLocale, type Locale, setLocale } from "@/paraglide/runtime"

  const isEnglish = getLocale() === "en"

  function updateLocale(lang: Locale) {
    setLocale(lang)
  }

</script>

<div class="join">
  <button
    onclick={() => updateLocale("nb")}
    class={[
      "btn join-item !text-cat-text border-cat-surface0",
      !isEnglish ? "bg-cat-mantle" : "bg-cat-base",
    ]}>Norsk
  </button
  >
  <button
    onclick={() => updateLocale("en")}
    class={[
      "btn join-item !text-cat-text border-cat-surface0",
      isEnglish ? "bg-cat-mantle" : "bg-cat-base",
    ]}>English
  </button
  >
</div>
