import { ReactNode } from "react";
import { TeamId } from "../../../../types/state";
import { Px } from "../../../../types/style";
import { getTeamFlagStyle } from "../../../../utils/dataLookup";
import {
Container,
Slant,
Sheen,
FlagEdge,
CountryFlagDiv,
FlagContainer,
TeamFlagDiv,
} from "./styles";
const countryFlags = require.context("../../../../public/images/countryFlags/angled", true);
const teamLogos = require.context("../../../../public/images/logos/team", true);
/**
* To look right, country flags need to be 2:1. Additional editing will be
* necessary for some flags to not cut off prominent elements. Ex: China's flag
* would have its stars mostly cut out without edits to place them closer to the
* center.
*/
type AngledFlagProps = {
flagHeight: Px,
flagProps: {
flagMode: "country",
flag: string,
} | {
flagMode: "team",
flag: TeamId,
},
};
export function AngledFlag(props: AngledFlagProps) {
const { flagProps, flagHeight } = props;
let topFlag: ReactNode = null;
let bottomFlag: ReactNode = null;
if (flagProps.flagMode === "country") {
topFlag = (
);
bottomFlag = (
);
} else if (flagProps.flagMode === "team") {
topFlag = (
);
bottomFlag = (
);
}
return (
{topFlag}
{bottomFlag}
);
}