ISSUE-031 - Progress checkpoint.
A lot of work going on here. * Moved WorkspaceControls component to a new sub directory * Renamed overlay images * Started a static ChyronDriverBasic component (using Hamilton as an example) * Created a fancy DriverNumber rendering system * Defined DriverNumber style for Mercedes and no one else yet * A bunch of new states for the grid: cars, drivers, teams, etc * Defined a bunch of data for the drivers and teams * Created another string utility function to generate repeat strings; unit tests included
This commit is contained in:
1 parent
1c38137480
commit
db14bf902f
21 files changed
+787
-41
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { DriverNumber } from "../../Common/DriverNumber";
|
||||
import {
|
||||
BaseBackground,
|
||||
FirstName,
|
||||
FlagNumber,
|
||||
LastName,
|
||||
NameContainer,
|
||||
NumberContainer,
|
||||
NumberFlag,
|
||||
TeamColorBar,
|
||||
TeamName,
|
||||
TextContainer,
|
||||
} from "./styles";
|
||||
|
||||
export function ChyronDriverBasic() {
|
||||
// TODO - Get driver details from Redux.
|
||||
|
||||
return (
|
||||
<BaseBackground>
|
||||
<NumberFlag>
|
||||
<FlagNumber>1</FlagNumber>
|
||||
</NumberFlag>
|
||||
<TeamColorBar color="#00d2be" />
|
||||
<TextContainer>
|
||||
<NameContainer>
|
||||
<FirstName>Lewis</FirstName>
|
||||
<LastName>Hamilton</LastName>
|
||||
<NumberContainer>
|
||||
<DriverNumber teamId="mercedes" fontSize="29px" number={44} />
|
||||
</NumberContainer>
|
||||
</NameContainer>
|
||||
<TeamName>Mercedes</TeamName>
|
||||
</TextContainer>
|
||||
</BaseBackground>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./ChyronDriverBasic";
|
||||
@@ -0,0 +1,96 @@
|
||||
import styled from "styled-components";
|
||||
|
||||
export const BaseBackground = styled.div`
|
||||
position: relative;
|
||||
width: 582px;
|
||||
height: 72px;
|
||||
|
||||
border-bottom-right-radius: 11px;
|
||||
background-color: #000;
|
||||
`;
|
||||
BaseBackground.displayName = "BaseBackground";
|
||||
|
||||
export const NumberFlag = styled.div`
|
||||
position: absolute;
|
||||
width: 61px;
|
||||
height: 61px;
|
||||
top: 6px;
|
||||
left: 6px;
|
||||
|
||||
border-bottom-right-radius: 9px;
|
||||
background-color: #f4f3ee;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
`;
|
||||
NumberFlag.displayName = "NumberFlag";
|
||||
|
||||
export const FlagNumber = styled.span`
|
||||
font-family: ${p => p.theme.fonts.f1Regular};
|
||||
font-size: 39px;
|
||||
margin-top: 2px;
|
||||
`;
|
||||
FlagNumber.displayName = "FlagNumber";
|
||||
|
||||
type TeamColorBarProps = {
|
||||
color: string,
|
||||
};
|
||||
export const TeamColorBar = styled.div<TeamColorBarProps>`
|
||||
position: absolute;
|
||||
width: 6px;
|
||||
height: 45px;
|
||||
top: 14px;
|
||||
left: 75px;
|
||||
|
||||
background-color: ${({ color }) => color};
|
||||
`;
|
||||
TeamColorBar.displayName = "TeamColorBar";
|
||||
|
||||
export const TextContainer = styled.div`
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 90px;
|
||||
`;
|
||||
TextContainer.displayName = "TextContainer";
|
||||
|
||||
export const NameContainer = styled.div`
|
||||
position: relative;
|
||||
top: 5px;
|
||||
`;
|
||||
NameContainer.displayName = "NameContainer";
|
||||
|
||||
export const FirstName = styled.span`
|
||||
font-family: ${p => p.theme.fonts.f1Regular};
|
||||
color: #fff;
|
||||
font-size: 25px;
|
||||
`;
|
||||
FirstName.displayName = "FirstName";
|
||||
|
||||
export const LastName = styled.span`
|
||||
font-family: ${p => p.theme.fonts.f1Bold};
|
||||
text-transform: uppercase;
|
||||
color: #fff;
|
||||
font-size: 25px;
|
||||
margin-left: 5px;
|
||||
`;
|
||||
LastName.displayName = "LastName";
|
||||
|
||||
export const NumberContainer = styled.div`
|
||||
position: relative;
|
||||
display: inline;
|
||||
|
||||
bottom: 3px;
|
||||
left: 10px;
|
||||
`;
|
||||
NumberContainer.displayName = "NumberContainer";
|
||||
|
||||
export const TeamName = styled.span`
|
||||
position: absolute;
|
||||
font-family: ${p => p.theme.fonts.f1Regular};
|
||||
color: #d1d1d1;
|
||||
font-size: 20px;
|
||||
bottom: 6px;
|
||||
`;
|
||||
TeamName.displayName = "TeamName";
|
||||
@@ -0,0 +1,44 @@
|
||||
import { TeamId } from "../../../../types/state";
|
||||
import { getTeamNumberStyle } from "../../../../utils/dataLookup";
|
||||
import { NumberContainer, ShadowNumber, StrokeNumber } from "./styles";
|
||||
|
||||
type DriverNumberProps = {
|
||||
number: number,
|
||||
fontSize: string,
|
||||
teamId: TeamId,
|
||||
};
|
||||
export function DriverNumber({ number, fontSize, teamId }: DriverNumberProps) {
|
||||
const style = getTeamNumberStyle(teamId);
|
||||
return (
|
||||
<NumberContainer>
|
||||
{style.rules.map((rule, i) => {
|
||||
if (rule.type === "stroke") {
|
||||
return (
|
||||
<StrokeNumber
|
||||
key={i}
|
||||
fontFamily={style.fontFamily}
|
||||
fontSize={fontSize}
|
||||
numberColor={style.numberColor}
|
||||
strokeColor={rule.color}
|
||||
strokeWidth={`${rule.width}em`}
|
||||
>
|
||||
{number}
|
||||
</StrokeNumber>
|
||||
);
|
||||
} else if (rule.type === "shadow") {
|
||||
return (
|
||||
<ShadowNumber
|
||||
key={i}
|
||||
fontFamily={style.fontFamily}
|
||||
fontSize={fontSize}
|
||||
numberColor={style.numberColor}
|
||||
shadowProperties={rule.property}
|
||||
>
|
||||
{number}
|
||||
</ShadowNumber>
|
||||
);
|
||||
}
|
||||
})}
|
||||
</NumberContainer>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./DriverNumber";
|
||||
@@ -0,0 +1,40 @@
|
||||
import styled from "styled-components";
|
||||
|
||||
export const NumberContainer = styled.div`
|
||||
position: relative;
|
||||
display: inline;
|
||||
`;
|
||||
NumberContainer.displayName = "NumberContainer";
|
||||
|
||||
type NumberProps = {
|
||||
fontFamily: string,
|
||||
fontSize: string,
|
||||
numberColor: string,
|
||||
}
|
||||
type StrokeNumberProps = NumberProps & {
|
||||
strokeColor: string,
|
||||
strokeWidth: string,
|
||||
}
|
||||
export const StrokeNumber = styled.span<StrokeNumberProps>`
|
||||
position: absolute;
|
||||
font-family: ${({ fontFamily }) => fontFamily};
|
||||
font-size: ${({ fontSize }) => fontSize};
|
||||
color: ${({ numberColor }) => numberColor};
|
||||
|
||||
-webkit-text-stroke-color: ${({ strokeColor }) => strokeColor};
|
||||
-webkit-text-stroke-width: ${({ strokeWidth }) => strokeWidth};
|
||||
`;
|
||||
StrokeNumber.displayName = "StrokeNumber";
|
||||
|
||||
type ShadowNumberProps = NumberProps & {
|
||||
shadowProperties: string,
|
||||
};
|
||||
export const ShadowNumber = styled.span<ShadowNumberProps>`
|
||||
position: absolute;
|
||||
font-family: ${({ fontFamily }) => fontFamily};
|
||||
font-size: ${({ fontSize }) => fontSize};
|
||||
color: ${({ numberColor }) => numberColor};
|
||||
|
||||
text-shadow: ${({ shadowProperties }) => shadowProperties};
|
||||
`;
|
||||
ShadowNumber.displayName = "ShadowNumber";
|
||||
@@ -50,12 +50,9 @@ export function OverlayDisplay({
|
||||
const xPos = currentOverlayItem?.position.x ?? 0;
|
||||
const yPos = currentOverlayItem?.position.y ?? 0;
|
||||
const transition = useTransition(visible, {
|
||||
from: { top: 50, opacity: 0 },
|
||||
enter: {
|
||||
top: 0,
|
||||
opacity: 1,
|
||||
},
|
||||
leave: { top: 50, opacity: 0 },
|
||||
from: { opacity: 0 },
|
||||
enter: { opacity: 1 },
|
||||
leave: { opacity: 0 },
|
||||
});
|
||||
|
||||
// Cannot make an earlier return because all hooks must run or React gets mad.
|
||||
|
||||
@@ -10,11 +10,10 @@ import { overlayToolSelector } from "../../../features/overlayTool/overlayToolSe
|
||||
import { newWorkspace } from "../../../features/overlayTool/overlayToolSlice";
|
||||
|
||||
import { PreviewWindow, H2, ControlsContainer } from "./styles";
|
||||
import { WorkspaceControls } from "./WorkspaceControls";
|
||||
import { MockupBlock } from "../../Common/MockupBlock.styled";
|
||||
import { WorkspaceControls } from "./WorkspaceControls/WorkspaceControls";
|
||||
import { OverlayDisplay } from "../../OverlayTool";
|
||||
|
||||
import { workspaces } from "../workspaces";
|
||||
import { fetchBroadcastGraphic, workspaces } from "../../../domain/data/workspaces";
|
||||
|
||||
export const Workspace = () => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -54,11 +53,7 @@ export const Workspace = () => {
|
||||
dimensions={workspaceProperties.previewWindowDimensions}
|
||||
animatedBG={animatedBG}
|
||||
>
|
||||
<MockupBlock
|
||||
color="#415bad"
|
||||
height="100px"
|
||||
width="100px"
|
||||
>Preview Item</MockupBlock>
|
||||
{fetchBroadcastGraphic(workspaceId)}
|
||||
<OverlayDisplay
|
||||
containerDimensions={workspaceProperties.previewWindowDimensions}
|
||||
/>
|
||||
|
||||
+4
-4
@@ -2,11 +2,11 @@ import { Grid } from "@bedrock-layout/grid";
|
||||
import { PadBox } from "@bedrock-layout/padbox";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
||||
import { workspaceSelector } from "../../../features/workspace/workspaceSelector";
|
||||
import { setAnimatedBG } from "../../../features/workspace/workspaceSlice";
|
||||
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
||||
import { setAnimatedBG } from "../../../../features/workspace/workspaceSlice";
|
||||
|
||||
import { Toggle } from "../../Common/Inputs/Toggle";
|
||||
import { OverlayControl } from "../../OverlayTool";
|
||||
import { Toggle } from "../../../Common/Inputs/Toggle";
|
||||
import { OverlayControl } from "../../../OverlayTool";
|
||||
|
||||
export const WorkspaceControls = () => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -5,7 +5,7 @@ import { WorkspaceListBox } from "./styles";
|
||||
import { Stack } from "@bedrock-layout/stack";
|
||||
import { MenuItem } from "../../Common/MenuItem.styled";
|
||||
|
||||
import { workspaces } from "../workspaces";
|
||||
import { workspaces } from "../../../domain/data/workspaces";
|
||||
|
||||
type WorkspaceListProps = {
|
||||
headerOffset?: number,
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import { WorkspaceProperties } from "../../types/state";
|
||||
|
||||
type WorkspaceObject = {
|
||||
[id: string]: WorkspaceProperties,
|
||||
};
|
||||
export const workspaces: WorkspaceObject = {
|
||||
chyronSimple: {
|
||||
name: "Chyron Simple",
|
||||
overlayIds: [
|
||||
"chyron-simple-full.png",
|
||||
"chyron-simple-opening-1.png",
|
||||
"chyron-simple-opening-2.png",
|
||||
],
|
||||
previewWindowDimensions: {
|
||||
width: 650,
|
||||
height: 200,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user