Files
stash/ui/v2.5/src/components/Shared/CountryFlag.tsx
DingDongSoLong4 a1851b3713 Update dependencies (#3123)
* Update localforage, remove query-string
* Update fontawesome and flag-icons
* Update formatjs
* Update axios and videojs
* Update apollo client and graphql
* Update bootstrap and react
* Update polyfills
* Update vite
* Update ESLint
* Update stylelint
* Update configs
* Rebuild yarn.lock
2023-02-16 14:06:44 +11:00

29 lines
574 B
TypeScript

import React from "react";
import { useIntl } from "react-intl";
import { getCountryByISO } from "src/utils";
interface ICountryFlag {
country?: string | null;
className?: string;
}
const CountryFlag: React.FC<ICountryFlag> = ({
className,
country: isoCountry,
}) => {
const { locale } = useIntl();
const country = getCountryByISO(isoCountry, locale);
if (!isoCountry || !country) return <></>;
return (
<span
className={`${className ?? ""} fi fi-${isoCountry.toLowerCase()}`}
title={country}
/>
);
};
export default CountryFlag;