ISSUE-031 - Almost forgot (I closed issue and merged the branch too early): Here's the important improvement that switches to using a clipped image div for the AngledFlag. There is now a carefully sized "bottom" flag that gives us a simulated parallax look. There is a simple xOffset that should allow us to animate two flags sliding over each other in the future.
Updated the use of "National" to "Country" and renamed some directories. Added a second larger AngledFlag to the Workspace (because changes that affect the larger size might be hidden by a smaller flag).
This commit is contained in:
1 parent
a32e5d656b
commit
b6cac82042
38 files changed
+126
-39
No files matched your search
@@ -1,9 +1,16 @@
|
||||
import { FlagMode } from "../../../../types/state";
|
||||
import { Px } from "../../../../types/style";
|
||||
import { Container, NationalFlag, Slant, Sheen, NationalFlagEdge } from "./styles";
|
||||
import {
|
||||
Container,
|
||||
Slant,
|
||||
Sheen,
|
||||
CountryFlagEdge,
|
||||
CountryFlagDiv,
|
||||
FlagContainer,
|
||||
} from "./styles";
|
||||
|
||||
const flags = require.context("../../../../public/images/flags/angled", true);
|
||||
const logos = require.context("../../../../public/images/logos", true);
|
||||
const countryFlags = require.context("../../../../public/images/countryFlags/angled", true);
|
||||
// const teamLogos = require.context("../../../../public/images/teamLogos", true);
|
||||
|
||||
/**
|
||||
* To look right, country flags need to be 2:1. Additional editing will be
|
||||
@@ -17,24 +24,55 @@ type AngledFlagProps = {
|
||||
flagHeight: Px,
|
||||
};
|
||||
export function AngledFlag({ flagMode, flag, flagHeight }: AngledFlagProps) {
|
||||
const topFlag = flagMode === "country"
|
||||
? (
|
||||
<CountryFlagDiv
|
||||
src={countryFlags(`./${flag}.svg`)}
|
||||
height={flagHeight}
|
||||
width={flagHeight * 2}
|
||||
>
|
||||
<CountryFlagEdge
|
||||
x={flagHeight / 2}
|
||||
height={flagHeight}
|
||||
girth={flagHeight * 0.07}
|
||||
/>
|
||||
</CountryFlagDiv>
|
||||
) : null; // Team flag here
|
||||
|
||||
const bottomFlag = flagMode === "country"
|
||||
? (
|
||||
<CountryFlagDiv
|
||||
src={countryFlags(`./${flag}.svg`)}
|
||||
height={flagHeight}
|
||||
width={flagHeight * 2}
|
||||
xOffset={-flagHeight * 0.005}
|
||||
/>
|
||||
) : null; // Team flag here
|
||||
|
||||
return (
|
||||
<Container width={flagHeight * 6} height={flagHeight * 3}>
|
||||
<Slant x={0} height={flagHeight * 3} girth={flagHeight * 2.4} />
|
||||
{flagMode === "country" ? (
|
||||
<>
|
||||
<NationalFlag
|
||||
alt=""
|
||||
src={flags(`./${flag}.svg`)}
|
||||
height={flagHeight}
|
||||
/>
|
||||
<NationalFlagEdge
|
||||
x={-(flagHeight / 2) + ((flagHeight * 0.07) / 2)}
|
||||
height={flagHeight}
|
||||
girth={flagHeight * 0.07}
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
<Sheen x={-10} height={flagHeight * 3} girth={flagHeight * 1.1} />
|
||||
<FlagContainer
|
||||
height={flagHeight}
|
||||
width={flagHeight * 2} // Dynamic width...
|
||||
collapsedWidth={flagHeight * 2}
|
||||
masked
|
||||
>
|
||||
<FlagContainer
|
||||
height={flagHeight}
|
||||
width={flagHeight * 2}
|
||||
collapsedWidth={flagHeight * 2}
|
||||
topFlag
|
||||
>
|
||||
{topFlag}
|
||||
</FlagContainer>
|
||||
{bottomFlag}
|
||||
</FlagContainer>
|
||||
<Sheen
|
||||
x={-flagHeight / 6.4}
|
||||
height={flagHeight * 3}
|
||||
girth={flagHeight * 1.1}
|
||||
/>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user