Skip to content

Commit 816d9a5

Browse files
committed
chore(demo): preload fonts to prevent layout shifts
1 parent b506f81 commit 816d9a5

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

examples/vite/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>Stream Chat React</title>
8+
<link rel="preconnect" href="https://fonts.googleapis.com" />
9+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10+
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap" />
11+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap" />
12+
<link rel="preload" as="font" type="font/woff2" crossorigin href="https://fonts.gstatic.com/s/geist/v4/gyByhwUxId8gMEwcGFU.woff2" />
813
</head>
914
<body>
1015
<div id="root"></div>

examples/vite/src/index.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@layer stream-new, stream-new-plugins, stream-overrides, stream-app-overrides;
22

3-
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap');
3+
// Geist font is preloaded in index.html to avoid layout shift on mount.
4+
//@import url('https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap');
45

56
// v3 CSS import
67
@import url('stream-chat-react/dist/css/index.css') layer(stream-new);

0 commit comments

Comments
 (0)