sendou.ink/app/components/Flag.tsx
Skyler 6c7648dc2d
Add title to flags so that hovering shows country name (#2336)
* Add title to flags so that hovering shows country name

* Use proper i18n for country names in flag titles

* Run Biome linter
2025-05-29 16:12:25 +03:00

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,
)}
/>
);
}