ISSUE-062 - Expanding status indicator in place.
Moved some dimensions data to the themes object for re-use between components.
This commit is contained in:
1 parent
28e0e7f3d4
commit
d2e4afb975
7 files changed
+79
-69
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||
import { theme } from "../../../../shared/theme";
|
||||
import { BGStatusIndicatorModes } from "../../../../types/state";
|
||||
import { DebugDurationProps } from "../../../../types/style";
|
||||
|
||||
import { StatusIndicatorBase } from "./styles";
|
||||
@@ -10,12 +12,23 @@ type StatusIndicatorProps = DebugDurationProps;
|
||||
export function StatusIndicator({
|
||||
debugDurationMultiplier: DDM = 1.0,
|
||||
}: StatusIndicatorProps) {
|
||||
const { design: { timingTower: ttTheme } } = theme;
|
||||
|
||||
const { timingBoard: { statusIndicator: { mode } } } =
|
||||
useSelector(broadcastGraphicsSelector);
|
||||
|
||||
return (
|
||||
<StatusIndicatorBase
|
||||
mode={mode}
|
||||
open={mode !== BGStatusIndicatorModes.LapNarrow}
|
||||
transitionOpeningProps={[{
|
||||
property: "width",
|
||||
duration: ttTheme.fullWidthDurationMs * DDM,
|
||||
}]}
|
||||
transitionClosingProps={[{
|
||||
property: "width",
|
||||
duration: ttTheme.fullWidthDurationMs * DDM,
|
||||
delay: ttTheme.fullWidthCloseDelayMs * DDM,
|
||||
}]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,22 +1,17 @@
|
||||
import styled, { css } from "styled-components";
|
||||
import styled from "styled-components";
|
||||
|
||||
import { BGStatusIndicatorModes } from "../../../../types/state";
|
||||
import { DirectionalTransitionProps } from "../../../../types/style";
|
||||
import { commonDirectionalTransition } from "../../../../utils/styling";
|
||||
|
||||
type StatusIndicatorBaseProps = {
|
||||
mode: BGStatusIndicatorModes,
|
||||
};
|
||||
export const StatusIndicatorBase = styled.div<StatusIndicatorBaseProps>`
|
||||
export const StatusIndicatorBase = styled.div<DirectionalTransitionProps>`
|
||||
background-color: black;
|
||||
border-top-right-radius: ${p => p.theme.design.statusIndicator.roundedCornerRadiusPx}px;
|
||||
height: ${p => p.theme.design.statusIndicator.heightNormalPx}px;
|
||||
width: ${({ theme: { design: { timingTower } }, mode }) => {
|
||||
if (mode === BGStatusIndicatorModes.LapNarrow) {
|
||||
return timingTower.rowLeftHalfWidthPx;
|
||||
}
|
||||
if (mode === BGStatusIndicatorModes.LapWide) {
|
||||
return timingTower.rowLeftHalfWidthPx + timingTower.rowRightHalfWidthPx;
|
||||
}
|
||||
return 10;
|
||||
}}px;
|
||||
width: ${({ theme: { design: { timingTower: ttTheme } }, open }) => open
|
||||
? ttTheme.rowLeftHalfWidthPx + ttTheme.rowRightHalfWidthPx
|
||||
: ttTheme.rowLeftHalfWidthPx}px;
|
||||
|
||||
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||
`;
|
||||
StatusIndicatorBase.displayName = "StatusIndicatorBase";
|
||||
Reference in new issue
Block a user