Adjusted the method that placement is determined. It didn't make much sense to define Placement in state, so I've moved it to the central theme object instead. I also took the time to support +10 laps and minutes with a special xScale setting for the TimingTowerRows.
75 lines
1.7 KiB
TypeScript
75 lines
1.7 KiB
TypeScript
import styled, { css } from "styled-components/macro";
|
|
|
|
import { Fraction, Placement, Px } from "../../../types/style";
|
|
import { placementStyleRules } from "../../../utils/styling";
|
|
|
|
type VideoFeedFrameProps = {
|
|
centered?: boolean,
|
|
};
|
|
export const VideoFeedFrame = styled.div<VideoFeedFrameProps>`
|
|
position: relative;
|
|
height: 100%;
|
|
width: 100%;
|
|
background-color: ${p => p.theme.colors.videoFrameBG};
|
|
overflow: hidden;
|
|
|
|
${({ centered = false }) => centered && css`
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
> div {
|
|
background-position: center;
|
|
}
|
|
`}
|
|
`;
|
|
|
|
type BroadcastLayoutProps = {
|
|
height: Px,
|
|
width: Px,
|
|
scale: Fraction,
|
|
};
|
|
export const BroadcastLayout = styled.div.attrs<BroadcastLayoutProps>(({
|
|
height,
|
|
width,
|
|
scale,
|
|
}) => ({ style: { height, width, transform: `scale(${scale})` } }))<BroadcastLayoutProps>`
|
|
position: absolute;
|
|
`;
|
|
|
|
export const BackgroundImage = styled.img`
|
|
height: 100%;
|
|
max-width: 100%;
|
|
object-fit: contain;
|
|
`;
|
|
|
|
type BackgroundImageDivProps = {
|
|
src: string,
|
|
}
|
|
export const BackgroundImageDiv = styled.div<BackgroundImageDivProps>`
|
|
height: 100%;
|
|
width: 100%;
|
|
background-image: ${({ src }) => `url("${src}")`};
|
|
background-size: contain;
|
|
background-repeat: no-repeat;
|
|
background-position: 0% 50%;
|
|
`;
|
|
|
|
export const DimensionsSpan = styled.span`
|
|
position: absolute;
|
|
top: 5px;
|
|
right: 10px;
|
|
color: ${p => p.theme.colors.textWhite};
|
|
font-family: ${p => p.theme.fonts.f1Regular};
|
|
`;
|
|
|
|
type LogoProps = {
|
|
placement: Placement,
|
|
height: Px,
|
|
};
|
|
export const Logo = styled.img<LogoProps>`
|
|
position: absolute;
|
|
${({ placement }) => placementStyleRules(placement)}
|
|
height: ${({ height }) => height}px;
|
|
`;
|