2024-07-20 10:26:19 +02:00
|
|
|
import Image from "next/image"
|
|
|
|
|
2024-07-06 02:33:49 +02:00
|
|
|
import type { CookiesStore } from "@/utils/constants"
|
2024-07-20 10:26:19 +02:00
|
|
|
import { useI18n } from "@/i18n/i18n.client"
|
2023-07-31 19:06:46 +02:00
|
|
|
|
|
|
|
export interface LocaleFlagProps {
|
|
|
|
locale: string
|
|
|
|
cookiesStore: CookiesStore
|
|
|
|
}
|
|
|
|
|
2023-08-01 17:22:09 +02:00
|
|
|
export const LocaleFlag = (props: LocaleFlagProps): JSX.Element => {
|
2023-07-31 19:06:46 +02:00
|
|
|
const { locale, cookiesStore } = props
|
|
|
|
|
|
|
|
const i18n = useI18n(cookiesStore)
|
|
|
|
|
|
|
|
return (
|
2024-07-20 10:26:19 +02:00
|
|
|
<>
|
|
|
|
<Image
|
|
|
|
quality={100}
|
|
|
|
width={35}
|
|
|
|
height={35}
|
|
|
|
src={`/images/locales/${locale}.svg`}
|
|
|
|
alt={locale}
|
|
|
|
/>
|
|
|
|
<p data-cy="locale-flag-text" className="mx-2 text-base">
|
|
|
|
{i18n.translate(`common.${locale}`)}
|
|
|
|
</p>
|
|
|
|
</>
|
2023-07-31 19:06:46 +02:00
|
|
|
)
|
|
|
|
}
|