Skip to content

Commit 671583e

Browse files
authored
add custom monospace font, UI tweaks (#2382)
1 parent e62dfb3 commit 671583e

File tree

5 files changed

+29
-10
lines changed

5 files changed

+29
-10
lines changed

components/Package/CodeBrowser/CodeBrowserContentHeader.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ export default function CodeBrowserContentHeader({ filePath, children }: Props)
1212
return (
1313
<View
1414
style={[
15-
tw`flex min-h-[45px] flex-row justify-between gap-3 border-b border-palette-gray2 bg-default px-4 py-3 dark:border-default`,
15+
tw`flex min-h-[45px] flex-row items-center justify-between gap-3 border-b border-palette-gray2 bg-default px-4 py-3 dark:border-default`,
1616
!children && tw`pr-20`,
1717
]}>
18-
<P style={[tw`font-mono mt-px font-bold`, { wordBreak: 'break-all' }]}>{filePath}</P>
18+
<P style={[tw`font-mono text-[13px]`, { wordBreak: 'break-all' }]}>{filePath}</P>
1919
{children}
2020
</View>
2121
);

components/Package/CodeBrowser/CodeBrowserFileRow.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useMemo, useState } from 'react';
22
import { Pressable, View } from 'react-native';
33

4-
import { Label } from '~/common/styleguide';
4+
import { P } from '~/common/styleguide';
55
import { FileIcon, FolderIcon, WarningBlockquote } from '~/components/Icons';
66
import Tooltip from '~/components/Tooltip';
77
import { getFileWarning } from '~/util/codeBrowser';
@@ -28,7 +28,7 @@ export default function CodeBrowserFileRow({
2828
const Icon = useMemo(() => (isDirectory ? FolderIcon : FileIcon), [isDirectory]);
2929

3030
const rowStyle = [
31-
tw`flex flex-row items-center gap-1.5 px-3 py-1 last:mb-20`,
31+
tw`flex flex-row items-center gap-1.5 px-3 py-[3px] last:mb-20`,
3232
{ paddingLeft: 12 + depth * 8 },
3333
];
3434

@@ -41,15 +41,15 @@ export default function CodeBrowserFileRow({
4141
isDirectory && tw`text-tertiary dark:text-accented`,
4242
]}
4343
/>
44-
<Label
44+
<P
4545
style={[
46-
tw`font-mono select-none`,
47-
isDirectory && tw`text-palette-gray5 dark:text-palette-gray4`,
46+
tw`font-mono select-none text-[12px] font-light tracking-normal`,
47+
isDirectory && tw`font-extralight text-palette-gray5 dark:text-palette-gray4`,
4848
isActive && tw`text-primary-darker dark:text-primary`,
4949
{ wordBreak: 'break-word' },
5050
]}>
5151
{label}
52-
</Label>
52+
</P>
5353
{warning && (
5454
<Tooltip
5555
trigger={
71.3 KB
Binary file not shown.

styles/styles.css

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
font-display: swap;
2525
}
2626

27+
@font-face {
28+
font-family: 'JetBrains Mono';
29+
src: url('/fonts/JetBrainsMono-Variable.woff2') format('woff2');
30+
font-style: normal;
31+
font-display: swap;
32+
}
33+
2734
/* TODO: refactor colors and naming */
2835
:root {
2936
--primary: #61dafb;
@@ -77,6 +84,7 @@
7784
--inline-code-background: var(--gray-2);
7885

7986
--quick-search-bg: #ffffff;
87+
--code-font-weight: 400;
8088
}
8189

8290
:root.dark {
@@ -117,6 +125,7 @@
117125
--inline-code-background: var(--gray-6);
118126

119127
--quick-search-bg: #111114ef;
128+
--code-font-weight: 300;
120129
}
121130

122131
*:focus-visible {
@@ -139,6 +148,13 @@ body {
139148
-moz-osx-font-smoothing: grayscale;
140149
}
141150

151+
code,
152+
pre {
153+
font-family: 'JetBrains Mono', ui-monospace, monospace;
154+
font-weight: var(--code-font-weight);
155+
font-variant-ligatures: none;
156+
}
157+
142158
input:focus-visible {
143159
@apply rounded;
144160
}
@@ -435,6 +451,7 @@ select {
435451

436452
& code {
437453
display: inline;
454+
font-weight: 500;
438455
}
439456

440457
&[align='center'] img {
@@ -501,10 +518,11 @@ select {
501518
}
502519

503520
code {
504-
font-size: 110%;
521+
font-size: 85%;
505522
background-color: var(--inline-code-background);
506523
border-radius: 4px;
507524
padding: 1px 4px;
525+
vertical-align: text-bottom;
508526
}
509527

510528
pre {
@@ -785,6 +803,7 @@ select {
785803
overflow-wrap: anywhere;
786804
white-space: pre-wrap;
787805
line-height: 16px;
806+
font-size: 75%;
788807
}
789808
}
790809

tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default {
4949
},
5050
fontFamily: {
5151
sans: ['Optimistic Display', 'ui-sans-serif', 'system-ui'],
52-
mono: ['monospace', 'ui-monospace'],
52+
mono: ['JetBrains Mono', 'monospace', 'ui-monospace'],
5353
},
5454
backgroundColor: {
5555
transparent: 'transparent',

0 commit comments

Comments
 (0)