mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-24 06:58:10 -05:00
* Add title to flags so that hovering shows country name * Use proper i18n for country names in flag titles * Run Biome linter
24 lines
461 B
TypeScript
24 lines
461 B
TypeScript
import clsx from "clsx";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
export function Flag({
|
|
countryCode,
|
|
tiny = false,
|
|
}: {
|
|
countryCode: string;
|
|
tiny?: boolean;
|
|
}) {
|
|
const { i18n } = useTranslation();
|
|
return (
|
|
<div
|
|
className={clsx(`twf twf-${countryCode.toLowerCase()}`, {
|
|
"twf-s": tiny,
|
|
})}
|
|
data-testid={`flag-${countryCode}`}
|
|
title={new Intl.DisplayNames([i18n.language], { type: "region" }).of(
|
|
countryCode,
|
|
)}
|
|
/>
|
|
);
|
|
}
|