This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
Files
scoresaber-reloadedv3/projects/website/src/components/country-flag.tsx

22 lines
653 B
TypeScript
Raw Normal View History

2024-10-13 00:41:39 +01:00
import Tooltip from "@/components/tooltip";
import { normalizedRegionName } from "@ssr/common/utils/region-utils";
2024-09-09 09:33:05 +01:00
type Props = {
code: string;
2024-09-09 09:33:05 +01:00
size?: number;
};
export default function CountryFlag({ code, size = 24 }: Props) {
2024-09-09 09:33:05 +01:00
return (
2024-10-20 13:59:48 +01:00
<Tooltip display={<p>{normalizedRegionName(code)}</p>} className={`w-[${size * 2}px] min-w-[${size * 2}px]`}>
2024-10-13 00:41:39 +01:00
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
alt="Player Country"
src={`/assets/flags/${code.toLowerCase()}.png`}
width={size * 2}
2024-10-20 13:59:48 +01:00
className={`w-[${size * 2}px] min-w-[${size * 2}px] object-contain`}
2024-10-13 00:41:39 +01:00
/>
</Tooltip>
2024-09-09 09:33:05 +01:00
);
}