Skip to content

Commit

Permalink
feat: tweak prompter styling
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarpl committed Feb 28, 2024
1 parent 61e94cd commit eed9372
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class OutputSettingsStore {
// _id: '',

// TODO: load these from persistent store upon startup?
fontSize: 4,
fontSize: 9,

mirrorHorizontally: false,
mirrorVertically: false,
Expand Down
39 changes: 29 additions & 10 deletions packages/apps/client/src/PrompterStyles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
--header-color: #999;

--prompter-font-size-base: 16px;
--prompter-line-height: calc(var(--prompter-font-size-base) * 1.4);
--prompter-line-height: calc(var(--prompter-font-size-base) * 1.1);
--prompter-horiz-padding: calc(var(--prompter-font-size-base) * 0.5);

color: var(--foreground-color);
background: var(--background-color);
Expand All @@ -13,7 +14,7 @@
white-space: pre-wrap;
white-space: break-spaces;

padding: 0 2em;
padding: 0 0;
overflow: auto;
box-sizing: border-box;

Expand All @@ -35,7 +36,8 @@

.Prompter p {
margin: 0;
padding: 0;
padding: 0 var(--prompter-horiz-padding);
letter-spacing: -0.2px;
}

.Prompter b {
Expand Down Expand Up @@ -66,24 +68,41 @@
background-color: var(--header-color);
color: var(--background-color);
user-select: none;
margin: 1em 0;
padding: 0 var(--prompter-horiz-padding);
line-height: 1.2em;
margin: 1em 0 0.1em;
}

.Prompter h1 {
font-size: calc(var(--prompter-font-size-base) * 2);
line-height: 1.4;
font-size: calc(var(--prompter-font-size-base) * 0.75);
}

.Prompter h2 {
font-size: calc(var(--prompter-font-size-base) * 1);
line-height: 1.4;
font-size: calc(var(--prompter-font-size-base) * 0.5);
margin-bottom: -1em;
}

.Prompter h3 {
font-size: calc(var(--prompter-font-size-base) * 1);
line-height: 1.4;
font-size: calc(var(--prompter-font-size-base) * 0.5);
padding: 0 calc(var(--prompter-horiz-padding) * 0.25);
margin: 1em 0 0 calc(var(--prompter-horiz-padding) * 0.75);
}

.Prompter .spacer {
height: 100vh;
}

.PrompterMarker {
font-size: var(--prompter-font-size-base);
position: absolute;
/* TODO: this needs to be configurable properly */
top: clamp(0.5em, calc(var(--prompter-font-size-base) * 2), calc(50% - var(--prompter-font-size-base) / 3));
left: 0;

width: 0px;
height: 0px;
border-style: solid;
border-width: 0.25em 0 0.25em 0.35em;
border-color: transparent transparent transparent #ff4532;
transform: rotate(0deg);
}
1 change: 1 addition & 0 deletions packages/apps/client/src/views/Output/Output.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ const Output = observer(function Output(): React.ReactElement {
<div className={className} style={styleVariables} ref={rootEl}>
{rundown && <RundownOutput rundown={rundown} />}
</div>
<div className="PrompterMarker" style={styleVariables} />
</>
)
})
Expand Down
17 changes: 14 additions & 3 deletions packages/apps/client/src/views/RundownScript/PreviewPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,21 @@ export const PreviewPanel = observer(function PreviewPanel(): React.ReactNode {
[fontSize, previewWidth, viewPortAspectRatio]
)

const markerStyle = useMemo(
() =>
({
'--prompter-font-size-base': `${(previewWidth * fontSize) / 100}px`,
} as React.CSSProperties),
[fontSize, previewWidth]
)

return (
<div className={`Prompter ${classes.PreviewPanel} bg-black`} ref={rootEl} style={style}>
{rundown && <RundownOutput rundown={rundown} />}
</div>
<>
<div className={`Prompter ${classes.PreviewPanel} bg-black`} ref={rootEl} style={style}>
{rundown && <RundownOutput rundown={rundown} />}
</div>
<div className="PrompterMarker" style={markerStyle} />
</>
)
})
PreviewPanel.displayName = 'PreviewPanel'

0 comments on commit eed9372

Please sign in to comment.