ISSUE-031 - Big update. AngledFlag component is born!
It's not 100% complete - I still need to add the second, slightly offset sub flag that goes beneath the main flag, creating a sort of refractive-glass/parallax effect. Needed to add a new workspace. Thankfully it's pretty easy to add a new workspace. So, kinda nice. Did a lot of work making 2:1 versions of each flag in vector. Was a bit of a pain in the ass. Renamed a prop for ProgressSlider, "onBarColor" because prefixing a prop with "on" is special for React and it gets upset and spits out an error.
This commit is contained in:
1 parent
55e07a444e
commit
4a9c124832
46 files changed
+1063
-70
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { FlagMode } from "../../../../types/state";
|
||||
import { Px } from "../../../../types/style";
|
||||
import { Container, NationalFlag, Slant, Sheen, NationalFlagEdge } from "./styles";
|
||||
|
||||
const flags = require.context("../../../../public/images/flags/angled", true);
|
||||
const logos = require.context("../../../../public/images/logos", 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 = {
|
||||
flagMode: FlagMode,
|
||||
flag: string,
|
||||
flagHeight: Px,
|
||||
};
|
||||
export function AngledFlag({ flagMode, flag, flagHeight }: AngledFlagProps) {
|
||||
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} />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user