---
import type { LocaleCode } from "../data/locales";

interface Props {
  copy: Record<LocaleCode, string>;
  className?: string;
  tag?: string;
  html?: boolean;
}

const {
  copy,
  className = "",
  tag = "span",
  html = false,
} = Astro.props;

const Tag = tag;
const order: LocaleCode[] = ["en", "fr", "nb"];
---

<Tag class={`locale-copy ${className}`.trim()}>
  {order.map((lang) => (
    <span
      class="locale-copy__text"
      data-locale-option={lang}
      set:html={html ? copy[lang] : undefined}
    >
      {html ? undefined : copy[lang]}
    </span>
  ))}
</Tag>
