Skip to content

Commit 0df6d54

Browse files
committed
wip: split boxes background
1 parent ced212f commit 0df6d54

File tree

2 files changed

+84
-34
lines changed

2 files changed

+84
-34
lines changed

packages/webui/src/client/ui/ClockView/ClockViewPieceIcons/ClockViewPieceIcons.scss

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import '../../../styles/variables';
2+
13
// Variables
24
$text-color: #ffffff;
35
$font-size-base: 70px;
@@ -24,6 +26,11 @@ $letter-spacing: 0.02em;
2426

2527
// Base icon styles
2628
.clock-view-piece-icon {
29+
// Container layout
30+
position: relative;
31+
width: 207px;
32+
height: 126px;
33+
2734
// Text styles:
2835
fill: $text-color;
2936
font-family: Roboto Flex;
@@ -35,6 +42,29 @@ $letter-spacing: 0.02em;
3542
span {
3643
// Common styles
3744
@include layer-type-backgrounds; // Apply to all span elements that have layer type classes
45+
46+
// Position text inside the icon
47+
position: absolute;
48+
top: 0;
49+
left: 0;
50+
width: 100%;
51+
height: 100%;
52+
display: flex;
53+
justify-content: center;
54+
align-items: center;
55+
z-index: 2;
56+
}
57+
58+
.piece-icon-text {
59+
position: absolute;
60+
top: 0;
61+
left: 0;
62+
width: 100%;
63+
height: 100%;
64+
display: flex;
65+
justify-content: center;
66+
align-items: center;
67+
z-index: 2;
3868
}
3969

4070
.live-speak {
@@ -47,17 +77,44 @@ $letter-spacing: 0.02em;
4777
align-items: center;
4878
}
4979

50-
// Split view specific styles
51-
.upper,
52-
.lower {
53-
&.camera {
54-
@include item-type-colors-svg();
80+
// Split view container and layers
81+
.split-view {
82+
position: absolute;
83+
top: 0;
84+
left: 0;
85+
width: 100%;
86+
height: 100%;
87+
border-radius: 4px;
88+
overflow: hidden;
89+
z-index: 1;
90+
91+
// Apply item-type-colors to each source layer type
92+
@each $layer-type in $layer-types {
93+
> .#{$layer-type} {
94+
position: absolute;
95+
left: 0;
96+
width: 100%;
97+
background-color: var(--segment-layer-background-#{$layer-type});
98+
99+
&.second {
100+
background-color: var(--segment-layer-background-#{$layer-type}--second);
101+
}
102+
}
55103
}
56-
&.remote {
57-
@include item-type-colors-svg();
104+
105+
// Position the layers
106+
> div:first-child {
107+
top: 0;
108+
height: 50%;
109+
border-top-left-radius: 4px;
110+
border-top-right-radius: 4px;
58111
}
59-
&.remote.second {
60-
@include item-type-colors-svg();
112+
113+
> div:last-child {
114+
bottom: 0;
115+
height: 50%;
116+
border-bottom-left-radius: 4px;
117+
border-bottom-right-radius: 4px;
61118
}
62119
}
63120
}

packages/webui/src/client/ui/ClockView/ClockViewPieceIcons/ClockViewRenderers/SplitInputIcon.tsx

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ import * as React from 'react'
22
import { PieceGeneric } from '@sofie-automation/corelib/dist/dataModel/Piece'
33
import { SplitsContent, SourceLayerType } from '@sofie-automation/blueprints-integration'
44
import { RundownUtils } from '../../../../lib/rundown'
5-
import classNames from 'classnames'
65
import { ReadonlyDeep } from 'type-fest'
76

87
type SplitIconPieceType = ReadonlyDeep<Omit<PieceGeneric, 'timelineObjectsString'>>
98

10-
export default class SplitInputIcon extends React.Component<{
9+
interface SplitInputIconProps {
1110
abbreviation: string | undefined
1211
piece: SplitIconPieceType | undefined
1312
hideLabel?: boolean
14-
}> {
15-
private getCameraLabel(piece: SplitIconPieceType | undefined) {
13+
}
14+
15+
export default function SplitInputIcon({ abbreviation, piece, hideLabel }: Readonly<SplitInputIconProps>): JSX.Element {
16+
function getCameraLabel() {
1617
if (piece && piece.content) {
1718
const c = piece.content as SplitsContent
1819
const camera = c.boxSourceConfiguration.find((i) => i.type === SourceLayerType.CAMERA)
@@ -21,18 +22,15 @@ export default class SplitInputIcon extends React.Component<{
2122
return (
2223
<React.Fragment>
2324
{label && label[1] ? label[1].substr(0, 1).toUpperCase() + ' ' : ''}
24-
<span className="camera">{label ? label[2] : ''}</span>
25+
<span>{label ? label[2] : ''}</span>
2526
</React.Fragment>
2627
)
27-
} else {
28-
return this.props.abbreviation !== undefined ? this.props.abbreviation : 'Spl'
2928
}
30-
} else {
31-
return this.props.abbreviation !== undefined ? this.props.abbreviation : 'Spl'
3229
}
30+
return abbreviation !== undefined ? abbreviation : 'Spl'
3331
}
3432

35-
private getLeftSourceType(piece: SplitIconPieceType | undefined): string {
33+
function getLeftSourceType(): string {
3634
if (piece && piece.content) {
3735
const c = piece.content as SplitsContent
3836
const left = (c.boxSourceConfiguration && c.boxSourceConfiguration[0])?.type || SourceLayerType.CAMERA
@@ -41,28 +39,23 @@ export default class SplitInputIcon extends React.Component<{
4139
return 'camera'
4240
}
4341

44-
private getRightSourceType(piece: SplitIconPieceType | undefined): string {
42+
function getRightSourceType(): string {
4543
if (piece && piece.content) {
4644
const c = piece.content as SplitsContent
4745
const right = (c.boxSourceConfiguration && c.boxSourceConfiguration[1])?.type || SourceLayerType.REMOTE
4846
const sourceType = RundownUtils.getSourceLayerClassName(right)
49-
return sourceType + (this.getLeftSourceType(piece) === sourceType ? ' second' : '')
47+
return sourceType + (getLeftSourceType() === sourceType ? ' second' : '')
5048
}
5149
return 'remote'
5250
}
5351

54-
render(): JSX.Element {
55-
return (
56-
<div className="clock-view-piece-icon">
57-
<rect width="126.5" height="44.5" className={classNames('upper', this.getLeftSourceType(this.props.piece))} />
58-
<rect
59-
width="126.5"
60-
height="44.5"
61-
y="44.5"
62-
className={classNames('lower', this.getRightSourceType(this.props.piece))}
63-
/>
64-
{!this.props.hideLabel && <span className="piece-icon-text">{this.getCameraLabel(this.props.piece)}</span>}
52+
return (
53+
<div className="clock-view-piece-icon">
54+
<div className="split-view">
55+
<div className={getLeftSourceType()}></div>
56+
<div className={getRightSourceType()}></div>
6557
</div>
66-
)
67-
}
58+
{!hideLabel && <span className="piece-icon-text">{getCameraLabel()}</span>}
59+
</div>
60+
)
6861
}

0 commit comments

Comments
 (0)