ISSUE-035 - Styled the Team flags individually.

Went through a lot of trouble to style the team flags to be wider than the country flags. This called for a troubling amount of ternary statements in the angled flag components.
I'm content with the results.
This commit is contained in:
Kyle Geib committed 2022-02-01 18:24:48 -05:00
1 parent bd1892ab17
commit b39d005e23
8 files changed
+168 -79

No files matched your search

@@ -15,6 +15,9 @@ import {
const countryFlags = require.context("../../../../public/images/countryFlags/angled", true);
const teamLogos = require.context("../../../../public/images/logos/team", true);
const FLAG_WIDTH_TEAM = 2.4;
const FLAG_WIDTH_COUNTRY = 2;
/**
* 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
@@ -42,7 +45,7 @@ export function AngledFlag(props: AngledFlagProps) {
<CountryFlagDiv
src={countryFlags(`./${flagProps.flag}.svg`)}
height={flagHeight}
width={flagHeight * 2}
width={flagHeight * FLAG_WIDTH_COUNTRY}
>
<FlagEdge
x={flagHeight / 2}
@@ -55,7 +58,7 @@ export function AngledFlag(props: AngledFlagProps) {
<CountryFlagDiv
src={countryFlags(`./${flagProps.flag}.svg`)}
height={flagHeight}
width={flagHeight * 2}
width={flagHeight * FLAG_WIDTH_COUNTRY}
xOffset={-flagHeight * 0.005}
/>
);
@@ -64,13 +67,13 @@ export function AngledFlag(props: AngledFlagProps) {
<TeamFlagDiv
src={teamLogos(`./${flagProps.flag}.svg`)}
height={flagHeight}
width={flagHeight * 2}
width={flagHeight * FLAG_WIDTH_TEAM}
style={getTeamFlagStyle(flagProps.flag)}
>
<FlagEdge
x={flagHeight / 2}
height={flagHeight}
girth={flagHeight * 0.07}
girth={flagHeight * 0.04}
/>
</TeamFlagDiv>
);
@@ -78,26 +81,31 @@ export function AngledFlag(props: AngledFlagProps) {
<TeamFlagDiv
src={teamLogos(`./${flagProps.flag}.svg`)}
height={flagHeight}
width={flagHeight * 2}
width={flagHeight * FLAG_WIDTH_TEAM}
style={getTeamFlagStyle(flagProps.flag)}
bottomFlag
/>
);
}
const flagModeWidth = flagProps.flagMode === "team" ? FLAG_WIDTH_TEAM : FLAG_WIDTH_COUNTRY;
return (
<Container width={flagHeight * 6} height={flagHeight * 3}>
<Slant x={0} height={flagHeight * 3} girth={flagHeight * 2.4} />
<FlagContainer
height={flagHeight}
width={flagHeight * 2} // Dynamic width...
collapsedWidth={flagHeight * 2}
width={flagHeight * flagModeWidth} // Dynamic width...
collapsedWidth={flagHeight * flagModeWidth}
masked
teamFlag={flagProps.flagMode === "team"}
>
<FlagContainer
height={flagHeight}
width={flagHeight * 2}
collapsedWidth={flagHeight * 2}
width={flagHeight * flagModeWidth}
collapsedWidth={flagHeight * flagModeWidth}
topFlag
teamFlag={flagProps.flagMode === "team"}
>
{topFlag}
</FlagContainer>