Skip to content

Commit 78634ea

Browse files
committed
Tighten clock face tracking when Inter font is selected
Per-font tracking lets thin Inter close up the digit gaps without affecting the serifs. Seconds span resets letter-spacing to avoid inheriting the parent's computed length at a much smaller font size.
1 parent 12ceb97 commit 78634ea

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

‎frontend/src/components/CurrentTime.tsx‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,22 @@ import useLocal from "../hooks/useLocal";
99
type CurrentTimeProps = {} & React.HTMLAttributes<HTMLDivElement>;
1010

1111
const DISPLAY_FONTS = [
12-
{ family: '"DM Serif Display", Georgia, serif', weight: 400 },
13-
{ family: '"Abril Fatface", Georgia, serif', weight: 400 },
14-
{ family: '"Instrument Serif", Georgia, serif', weight: 400 },
15-
{ family: '"Inter", system-ui, sans-serif', weight: 300 },
12+
{
13+
family: '"DM Serif Display", Georgia, serif',
14+
weight: 400,
15+
tracking: "-0.02em",
16+
},
17+
{
18+
family: '"Abril Fatface", Georgia, serif',
19+
weight: 400,
20+
tracking: "-0.02em",
21+
},
22+
{
23+
family: '"Instrument Serif", Georgia, serif',
24+
weight: 400,
25+
tracking: "-0.02em",
26+
},
27+
{ family: '"Inter", system-ui, sans-serif', weight: 300, tracking: "-0.1em" },
1628
];
1729

1830
const CurrentTime: React.FC<CurrentTimeProps> = ({ className }) => {
@@ -43,7 +55,7 @@ const CurrentTime: React.FC<CurrentTimeProps> = ({ className }) => {
4355
fontSize: "7em",
4456
lineHeight: 1,
4557
fontWeight: displayFont.weight,
46-
letterSpacing: "-0.02em",
58+
letterSpacing: displayFont.tracking,
4759
fontVariantNumeric: "tabular-nums",
4860
display: "flex",
4961
alignItems: "baseline",
@@ -64,6 +76,7 @@ const CurrentTime: React.FC<CurrentTimeProps> = ({ className }) => {
6476
marginLeft: "0.4em",
6577
marginBottom: "0.6em",
6678
alignSelf: "flex-end",
79+
letterSpacing: "normal",
6780
fontVariantNumeric: "tabular-nums",
6881
}}
6982
>

0 commit comments

Comments
 (0)