ISSUE-054 - Added Team Gems to TimingTower.
Finer calibration to row sizing (not 37px or 36px high, but 36.5px!) and position flag font size.
This commit is contained in:
1 parent
39bddc4cf1
commit
2ad7fdd24c
12 files changed
+202
-21
No files matched your search
@@ -98,7 +98,7 @@ type TeamFlagDivProps = {
|
||||
style: TeamFlagStyle,
|
||||
bottomFlag?: boolean,
|
||||
};
|
||||
export const TeamFlagDiv = styled(FlagDivBase) <TeamFlagDivProps>`
|
||||
export const TeamFlagDiv = styled(FlagDivBase)<TeamFlagDivProps>`
|
||||
height: ${({ height }) => `${height}px`};
|
||||
width: ${({ width }) => `${width}px`};
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import { Px } from "../../../../types/style";
|
||||
import { Fraction, Px } from "../../../../types/style";
|
||||
|
||||
import { PositionFlagBox, PositionNumber } from "./styles";
|
||||
|
||||
type PositionFlagProps = {
|
||||
size: Px,
|
||||
number: number,
|
||||
numberSizeFraction?: Fraction,
|
||||
};
|
||||
export function PositionFlag({ size, number }: PositionFlagProps) {
|
||||
export function PositionFlag({ size, number, numberSizeFraction = 0.64 }: PositionFlagProps) {
|
||||
return (
|
||||
<PositionFlagBox size={size}>
|
||||
<PositionNumber size={size}>
|
||||
<PositionNumber size={size * numberSizeFraction}>
|
||||
{number}
|
||||
</PositionNumber>
|
||||
</PositionFlagBox>
|
||||
|
||||
@@ -23,7 +23,7 @@ type PositionNumberProps = {
|
||||
};
|
||||
export const PositionNumber = styled.span<PositionNumberProps>`
|
||||
font-family: ${p => p.theme.fonts.f1Regular};
|
||||
font-size: ${({ size }) => `${size * 0.64}px`};
|
||||
font-size: ${({ size }) => size}px;
|
||||
margin-top: 2px;
|
||||
`;
|
||||
PositionNumber.displayName = "PositionNumber";
|
||||
@@ -0,0 +1,26 @@
|
||||
import { TeamId } from "../../../../types/state";
|
||||
import { Px } from "../../../../types/style";
|
||||
import { getTeamGemStyle } from "../../../../utils/dataLookup";
|
||||
import { GemColorDiv, GemContainer, GemLogoDiv } from "./styles";
|
||||
|
||||
const teamLogos = require.context("../../../../public/images/logos/team", true);
|
||||
|
||||
type TeamGemProps = {
|
||||
height: Px,
|
||||
team: TeamId,
|
||||
};
|
||||
export function TeamGem({ height, team }: TeamGemProps) {
|
||||
return (
|
||||
<GemContainer height={height}>
|
||||
<GemColorDiv
|
||||
height={height}
|
||||
gemStyle={getTeamGemStyle(team)}
|
||||
/>
|
||||
<GemLogoDiv
|
||||
height={height}
|
||||
src={teamLogos(`./${team}.svg`)}
|
||||
gemStyle={getTeamGemStyle(team)}
|
||||
/>
|
||||
</GemContainer>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./TeamGem";
|
||||
@@ -0,0 +1,60 @@
|
||||
import styled from "styled-components";
|
||||
import { TeamGemStyle } from "../../../../domain/data/teams";
|
||||
import { Px } from "../../../../types/style";
|
||||
|
||||
|
||||
const GEM_WIDTH_RATIO = 1.21;
|
||||
|
||||
type GemContainerProps = {
|
||||
height: Px,
|
||||
};
|
||||
export const GemContainer = styled.div<GemContainerProps>`
|
||||
position: relative;
|
||||
height: ${({ height }) => height}px;
|
||||
width: ${({ height }) => height * GEM_WIDTH_RATIO}px;
|
||||
|
||||
overflow: hidden;
|
||||
background-color: black;
|
||||
border-bottom-right-radius: 3px;
|
||||
|
||||
mask-image: linear-gradient(to left, black 0%, black 80%, transparent 100%);
|
||||
clip-path: polygon(40% 0, 100% 0, 100% 100%, 0 100%, 0 50%);
|
||||
`;
|
||||
GemContainer.displayName = "GemContainer";
|
||||
|
||||
type GemColorDivProps = {
|
||||
height: Px,
|
||||
gemStyle: TeamGemStyle,
|
||||
};
|
||||
export const GemColorDiv = styled.div<GemColorDivProps>`
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
background-image: radial-gradient(
|
||||
circle at 120% 160%,
|
||||
${({ gemStyle: { backgroundColor } }) => backgroundColor} 50%,
|
||||
black 100%
|
||||
);
|
||||
background-size: 100%;
|
||||
background-repeat: no-repeat;
|
||||
`;
|
||||
|
||||
type GemLogoDivProps = {
|
||||
height: Px,
|
||||
gemStyle: TeamGemStyle,
|
||||
src: string,
|
||||
};
|
||||
export const GemLogoDiv = styled.div<GemLogoDivProps>`
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
background-image: url(${({ src }) => src});
|
||||
background-size: ${({ gemStyle: { imageSize } }) => imageSize}%;
|
||||
background-position: ${({ height, gemStyle: { imagePos: { x, y } } }) => (
|
||||
`${height * GEM_WIDTH_RATIO * x}px ${height * y}px`
|
||||
)};
|
||||
background-repeat: no-repeat;
|
||||
`;
|
||||
GemLogoDiv.displayName = "GemDiv";
|
||||
Reference in new issue
Block a user