Skip to content

Visualize Your Ideas With Code

refactor(ui): clean up font styles (#694)

Jacob02f7d1f5798e
diff --git a/packages/ui/src/Index.module.scss b/packages/ui/src/Index.module.scss
index ceffa754..8080585c 100644
--- a/packages/ui/src/Index.module.scss
+++ b/packages/ui/src/Index.module.scss
@@ -11,10 +11,7 @@
.header {
position: sticky;
top: 0;
- font-size: 16px;
- line-height: 24px;
- text-transform: uppercase;
- font-weight: bold;
+ margin: 0;
display: flex;
gap: 16px;
padding: 16px;
@@ -47,6 +44,6 @@
}
.subtitle {
- font-size: 11px;
+ font-size: var(--font-size-small);
color: rgba(255, 255, 255, 0.32);
}
diff --git a/packages/ui/src/Index.tsx b/packages/ui/src/Index.tsx
index 2ce7b52b..484d623b 100644
--- a/packages/ui/src/Index.tsx
+++ b/packages/ui/src/Index.tsx
@@ -1,3 +1,4 @@
+import {Header} from './components/layout';
import styles from './Index.module.scss';
export interface ProjectData {
@@ -13,7 +14,7 @@ export interface IndexProps {
export function Index({projects}: IndexProps) {
return (
<div className={styles.root}>
- <div className={styles.header}>Projects</div>
+ <Header className={styles.header}>Projects</Header>
<div className={styles.list}>
{projects.map(project => (
<a className={styles.element} href={`./${project.fileName}`}>
diff --git a/packages/ui/src/components/console/Console.module.scss b/packages/ui/src/components/console/Console.module.scss
index 809d54ef..a218e95b 100644
--- a/packages/ui/src/components/console/Console.module.scss
+++ b/packages/ui/src/components/console/Console.module.scss
@@ -33,7 +33,6 @@ $colors: (
border-left: 4px solid transparent;
background-color: var(--background-color-dark);
border-radius: var(--radius);
- line-height: 24px;
padding: 8px;
overflow: hidden;
display: none;
@@ -68,6 +67,8 @@ $colors: (
}
.stack {
+ font-family: var(--font-family-mono);
+ font-size: var(--font-size-small);
overflow-x: auto;
margin-top: 8px;
@@ -131,7 +132,6 @@ $colors: (
}
.entry {
- font-size: 12px;
line-height: 20px;
white-space: nowrap;
@@ -141,7 +141,6 @@ $colors: (
}
.link {
- font-size: 12px;
cursor: pointer;
color: inherit;
diff --git a/packages/ui/src/components/console/Log.tsx b/packages/ui/src/components/console/Log.tsx
index 63eca444..7294942f 100644
--- a/packages/ui/src/components/console/Log.tsx
+++ b/packages/ui/src/components/console/Log.tsx
@@ -51,7 +51,7 @@ export function Log({payload}: LogProps) {
{hasBody && <Toggle open={open} onToggle={setOpen} />}
<div className={styles.message}>{payload.message}</div>
{duration !== null && (
- <div className={styles.duration}>{duration} ms</div>
+ <code className={styles.duration}>{duration} ms</code>
)}
{payload.inspect && (
<IconButton
diff --git a/packages/ui/src/components/controls/Controls.module.scss b/packages/ui/src/components/controls/Controls.module.scss
index a181fe83..7dd34382 100644
--- a/packages/ui/src/components/controls/Controls.module.scss
+++ b/packages/ui/src/components/controls/Controls.module.scss
@@ -61,7 +61,6 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
- line-height: 24px;
}
.select,
@@ -72,9 +71,7 @@
border: 0;
border-radius: var(--radius);
padding: 0 8px;
- font-size: 14px;
height: 24px;
- line-height: 24px;
flex-shrink: 1;
flex-grow: 1;
min-width: 0;
@@ -100,6 +97,11 @@
}
}
+.select,
+.input {
+ font-family: var(--font-family-mono);
+}
+
.inputSelect {
display: flex;
flex-grow: 1;
@@ -117,7 +119,7 @@
}
.select {
- font-size: 0;
+ width: 0;
flex-grow: 0;
flex-basis: 0;
padding: 0 12px;
@@ -219,6 +221,7 @@
justify-content: center;
overflow: hidden;
white-space: nowrap;
+ text-transform: uppercase;
gap: 8px;
&:disabled {
@@ -265,7 +268,6 @@
color: rgba(255, 255, 255, 0.7);
background-color: var(--surface-color-light);
user-select: none;
- line-height: 24px;
border-radius: 12px;
padding: 0 12px;
cursor: pointer;
diff --git a/packages/ui/src/components/fields/Expandable.module.scss b/packages/ui/src/components/fields/Expandable.module.scss
index a9b941d8..599f18eb 100644
--- a/packages/ui/src/components/fields/Expandable.module.scss
+++ b/packages/ui/src/components/fields/Expandable.module.scss
@@ -4,7 +4,6 @@
.title {
padding: 8px 0;
- line-height: 24px;
user-select: none;
cursor: pointer;
diff --git a/packages/ui/src/components/fields/Layout.module.scss b/packages/ui/src/components/fields/Layout.module.scss
index 3d07d5ff..82281966 100644
--- a/packages/ui/src/components/fields/Layout.module.scss
+++ b/packages/ui/src/components/fields/Layout.module.scss
@@ -6,7 +6,6 @@
background: var(--field-color);
color: rgba(255, 255, 255, 0.6);
border-radius: var(--radius);
- line-height: 24px;
flex-shrink: 1;
flex-grow: 1;
flex-basis: 100%;
@@ -87,6 +86,7 @@
}
.value {
+ font-family: var(--font-family-mono);
padding: 0 8px;
flex-shrink: 0;
overflow: hidden;
diff --git a/packages/ui/src/components/footer/Footer.module.scss b/packages/ui/src/components/footer/Footer.module.scss
index 5183e727..7d2f5ea6 100644
--- a/packages/ui/src/components/footer/Footer.module.scss
+++ b/packages/ui/src/components/footer/Footer.module.scss
@@ -9,6 +9,8 @@
gap: 4px;
grid-area: footer;
border-top: 2px solid var(--border-color);
+ font-size: var(--font-size-small);
+ line-height: 16px;
}
.shortcuts {
@@ -31,11 +33,8 @@
border-radius: var(--radius);
margin-right: 4px;
padding: 0 4px;
- font-size: 12px;
}
.action {
- font-size: 12px;
- line-height: 16px;
white-space: nowrap;
}
}
diff --git a/packages/ui/src/components/footer/Footer.tsx b/packages/ui/src/components/footer/Footer.tsx
index f9629822..7552ab9f 100644
--- a/packages/ui/src/components/footer/Footer.tsx
+++ b/packages/ui/src/components/footer/Footer.tsx
@@ -11,7 +11,7 @@ export function Footer() {
.filter(({available}) => !available || available())
.map(({key, action}) => (
<div className={styles.shortcut}>
- <span className={styles.key}>{key}</span>
+ <code className={styles.key}>{key}</code>
<span className={styles.action}>{action}</span>
</div>
))}
diff --git a/packages/ui/src/components/footer/Versions.module.scss b/packages/ui/src/components/footer/Versions.module.scss
index d02cc736..09799c3f 100644
--- a/packages/ui/src/components/footer/Versions.module.scss
+++ b/packages/ui/src/components/footer/Versions.module.scss
@@ -6,8 +6,6 @@
}
.link {
- font-size: 12px;
- line-height: 16px;
cursor: pointer;
text-decoration: none;
white-space: nowrap;
@@ -20,7 +18,3 @@
color: var(--theme);
}
}
-
-.input {
- display: none;
-}
diff --git a/packages/ui/src/components/footer/Versions.tsx b/packages/ui/src/components/footer/Versions.tsx
index 26cdfb07..88642516 100644
--- a/packages/ui/src/components/footer/Versions.tsx
+++ b/packages/ui/src/components/footer/Versions.tsx
@@ -48,7 +48,7 @@ export function Versions() {
navigator.clipboard.writeText(text);
}}
>
- {versions.core}
+ <code>{versions.core}</code>
</div>
</div>
);
diff --git a/packages/ui/src/components/layout/Header.module.scss b/packages/ui/src/components/layout/Header.module.scss
index 8dd37df8..41bb682d 100644
--- a/packages/ui/src/components/layout/Header.module.scss
+++ b/packages/ui/src/components/layout/Header.module.scss
@@ -1,6 +1,5 @@
.header {
- font-size: 16px;
- line-height: 24px;
+ font-size: var(--font-size-big);
text-transform: uppercase;
font-weight: bold;
margin-bottom: 16px;
diff --git a/packages/ui/src/components/layout/Header.tsx b/packages/ui/src/components/layout/Header.tsx
index c119f3c2..3e7abab8 100644
--- a/packages/ui/src/components/layout/Header.tsx
+++ b/packages/ui/src/components/layout/Header.tsx
@@ -1,11 +1,10 @@
-import {ComponentChildren} from 'preact';
-
import styles from './Header.module.scss';
+import type {JSX} from 'preact';
+import clsx from 'clsx';
-export interface HeaderProps {
- children: ComponentChildren;
-}
-
-export function Header({children}: HeaderProps) {
- return <div className={styles.header}>{children}</div>;
+export function Header({
+ className,
+ ...props
+}: JSX.HTMLAttributes<HTMLDivElement>) {
+ return <div className={clsx(styles.header, className)} {...props} />;
}
diff --git a/packages/ui/src/components/presentation/PresentationControls.module.scss b/packages/ui/src/components/presentation/PresentationControls.module.scss
index 24770a2c..ca0fec52 100644
--- a/packages/ui/src/components/presentation/PresentationControls.module.scss
+++ b/packages/ui/src/components/presentation/PresentationControls.module.scss
@@ -11,8 +11,6 @@
.count {
color: rgba(255, 255, 255, 0.32);
- font-size: 14px;
- line-height: 24px;
text-align: right;
user-select: none;
}
diff --git a/packages/ui/src/components/presentation/SlideGraph.module.scss b/packages/ui/src/components/presentation/SlideGraph.module.scss
index 5cb209be..11b17846 100644
--- a/packages/ui/src/components/presentation/SlideGraph.module.scss
+++ b/packages/ui/src/components/presentation/SlideGraph.module.scss
@@ -13,7 +13,6 @@
.slide {
display: block;
color: inherit;
- line-height: 24px;
text-align: start;
padding: 4px 8px 4px 36px;
width: 100%;
diff --git a/packages/ui/src/components/sidebar/VideoSettings.tsx b/packages/ui/src/components/sidebar/VideoSettings.tsx
index 426a2b84..73a0b759 100644
--- a/packages/ui/src/components/sidebar/VideoSettings.tsx
+++ b/packages/ui/src/components/sidebar/VideoSettings.tsx
@@ -33,7 +33,7 @@ export function VideoSettings() {
title="Reveal the output directory in file explorer"
onClick={openOutputPath}
>
- OUTPUT DIRECTORY
+ Output Directory
</Button>
</Group>
)}
@@ -73,9 +73,9 @@ function ProcessButton({processId, setProcess}: ProcessButtonProps) {
options={[
{
value: 0,
- text: 'RENDER',
+ text: 'Render',
},
- {value: 1, text: 'PRESENT'},
+ {value: 1, text: 'Present'},
]}
/>
) : (
@@ -89,7 +89,7 @@ function ProcessButton({processId, setProcess}: ProcessButtonProps) {
renderer.abort();
}}
>
- {rendererState === RendererState.Working ? 'ABORT' : 'ABORTING'}
+ {rendererState === RendererState.Working ? 'Abort' : 'Aborting'}
</Button>
);
}
diff --git a/packages/ui/src/components/tabs/Tabs.module.scss b/packages/ui/src/components/tabs/Tabs.module.scss
index e27b5cf9..43642cb8 100644
--- a/packages/ui/src/components/tabs/Tabs.module.scss
+++ b/packages/ui/src/components/tabs/Tabs.module.scss
@@ -43,7 +43,8 @@
}
.badge {
- font-size: 12px;
+ font-size: var(--font-size-small);
+ line-height: 16px;
color: rgba(255, 255, 255, 0.7);
position: absolute;
font-weight: 900;
@@ -54,7 +55,6 @@
height: 16px;
background-color: var(--red);
border-radius: 8px;
- line-height: 16px;
text-align: center;
z-index: 1;
}
diff --git a/packages/ui/src/components/timeline/Timeline.module.scss b/packages/ui/src/components/timeline/Timeline.module.scss
index e157dcd9..8d6acfef 100644
--- a/packages/ui/src/components/timeline/Timeline.module.scss
+++ b/packages/ui/src/components/timeline/Timeline.module.scss
@@ -76,7 +76,8 @@
}
&::after {
- font-size: 12px;
+ font-family: var(--font-family-mono);
+ font-size: var(--font-size-small);
line-height: 32px;
margin-top: -32px;
text-align: center;
@@ -118,7 +119,6 @@
color: inherit;
cursor: pointer;
position: relative;
- line-height: 24px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -190,10 +190,10 @@
&::before {
content: attr(data-name);
display: block;
- line-height: 24px;
border-radius: 0 12px 12px 12px;
padding: 0 8px;
color: rgba(0, 0, 0, 0.87);
+ font-weight: bold;
background-color: var(--theme);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.54);
}
@@ -260,7 +260,8 @@
padding: 0 4px;
border-radius: var(--radius);
background-color: var(--theme);
- font-size: 12px;
+ font-family: var(--font-family-mono);
+ font-size: var(--font-size-small);
line-height: 20px;
font-weight: bold;
color: #000000;
diff --git a/packages/ui/src/components/viewport/Viewport.module.scss b/packages/ui/src/components/viewport/Viewport.module.scss
index adbbc63e..abba117e 100644
--- a/packages/ui/src/components/viewport/Viewport.module.scss
+++ b/packages/ui/src/components/viewport/Viewport.module.scss
@@ -61,15 +61,11 @@
.time {
color: rgba(255, 255, 255, 0.54);
- font-size: 14px;
- line-height: 24px;
text-align: left;
}
.duration {
color: rgba(255, 255, 255, 0.54);
- font-size: 14px;
- line-height: 24px;
text-align: right;
}
diff --git a/packages/ui/src/components/viewport/Viewport.tsx b/packages/ui/src/components/viewport/Viewport.tsx
index ede71b73..1e1b9bdee 100644
--- a/packages/ui/src/components/viewport/Viewport.tsx
+++ b/packages/ui/src/components/viewport/Viewport.tsx
@@ -27,22 +27,22 @@ export function Viewport() {
<CurrentTime
render={time => {
return (
- <div className={styles.time} title="Current time">
+ <code className={styles.time} title="Current time">
{formatDuration(player.status.framesToSeconds(time))}
<span className={styles.frames}>
[{formatFrames(time, speed)}]
</span>
- </div>
+ </code>
);
}}
/>
<PlaybackControls />
- <div className={styles.duration} title="Duration">
+ <code className={styles.duration} title="Duration">
<span className={styles.frames}>
[{formatFrames(duration, speed)}]
</span>
{formatDuration(player.status.framesToSeconds(duration))}
- </div>
+ </code>
</div>
</div>
);
diff --git a/packages/ui/src/index.scss b/packages/ui/src/index.scss
index e3035c68..1195f853 100644
--- a/packages/ui/src/index.scss
+++ b/packages/ui/src/index.scss
@@ -20,6 +20,15 @@
--duration-normal: 0.2s;
--duration-fast: 0.1s;
+ --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
+ Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
+ 'Segoe UI Symbol';
+ --font-family: 'JetBrains Mono';
+ --font-family-mono: 'JetBrains Mono';
+ --font-size: 14px;
+ --font-size-small: 12px;
+ --font-size-big: 16px;
+
--red: #e13238;
--yellow: #e6a700;
--blue: #4cb3d4;
@@ -38,8 +47,6 @@
* {
box-sizing: border-box;
- font-family: 'JetBrains Mono', sans-serif;
- font-size: 14px;
accent-color: var(--theme);
&::-webkit-scrollbar {
@@ -61,6 +68,9 @@
html,
body {
+ font-family: var(--font-family);
+ font-size: var(--font-size);
+ line-height: 24px;
overflow: hidden;
padding: 0;
margin: 0;
@@ -76,6 +86,19 @@ main {
justify-content: center;
}
+button,
+input,
+select {
+ font-family: inherit;
+ font-size: inherit;
+ line-height: inherit;
+}
+
+code,
+pre {
+ font-family: var(--font-family-mono);
+}
+
svg {
display: block;
width: 24px;