@@ -22,15 +22,7 @@ import {
22
22
} from '@gitbook/colors' ;
23
23
import { IconStyle , IconsProvider } from '@gitbook/icons' ;
24
24
25
- import {
26
- type CustomizationFont ,
27
- fontNotoColorEmoji ,
28
- fonts ,
29
- generateFontFacesCSS ,
30
- getCustomFontSources ,
31
- getFontData ,
32
- ibmPlexMono ,
33
- } from '@/fonts' ;
25
+ import { fontNotoColorEmoji , getFontData , ibmPlexMono } from '@/fonts' ;
34
26
import { getSpaceLanguage } from '@/intl/server' ;
35
27
import { getAssetURL } from '@/lib/assets' ;
36
28
import { tcls } from '@/lib/tailwind' ;
@@ -77,7 +69,7 @@ export async function CustomizationRootLayout(props: {
77
69
sidebarStyles . list && `sidebar-list-${ sidebarStyles . list } ` ,
78
70
'links' in customization . styling && `links-${ customization . styling . links } ` ,
79
71
fontNotoColorEmoji . variable ,
80
- ! fontData . isCustom ? fontData . fontVariable : '' , // Only use fontVariable for default fonts
72
+ fontData . isCustom ? 'font-content' : fontData . fontVariable ,
81
73
ibmPlexMono . variable
82
74
) }
83
75
>
@@ -87,22 +79,23 @@ export async function CustomizationRootLayout(props: {
87
79
) : null }
88
80
89
81
{ /* Font preloading for custom fonts */ }
90
- { fontData . isCustom &&
91
- fontData . fontSources . map ( ( { url, format } ) => (
92
- < link
93
- key = { url . href }
94
- rel = "preload"
95
- href = { url . href }
96
- as = "font"
97
- type = { format ? `font/${ format } ` : undefined }
98
- crossOrigin = "anonymous"
99
- />
100
- ) ) }
82
+ { fontData . isCustom
83
+ ? fontData . fontSources . map ( ( { url, format } ) => (
84
+ < link
85
+ key = { url . href }
86
+ rel = "preload"
87
+ href = { url . href }
88
+ as = "font"
89
+ type = { format ? `font/${ format } ` : undefined }
90
+ crossOrigin = "anonymous"
91
+ />
92
+ ) )
93
+ : null }
101
94
102
95
{ /* Custom font CSS */ }
103
- { fontData . isCustom && fontData . fontCSS && (
96
+ { fontData . isCustom && fontData . fontCSS ? (
104
97
< style id = "custom-font-styles" > { fontData . fontCSS } </ style >
105
- ) }
98
+ ) : null }
106
99
107
100
< style
108
101
nonce = {
@@ -149,9 +142,6 @@ export async function CustomizationRootLayout(props: {
149
142
</ head >
150
143
< body
151
144
className = { tcls (
152
- fontNotoColorEmoji . className ,
153
- hasCustomFont ? 'font-sans' : fonts [ customization . styling . font ] . className ,
154
- `${ ibmPlexMono . variable } ` ,
155
145
'bg-tint-base' ,
156
146
'theme-muted:bg-tint-subtle' ,
157
147
'theme-bold-tint:bg-tint-subtle' ,
@@ -286,58 +276,7 @@ function getSemanticColors(
286
276
} ,
287
277
} ;
288
278
}
289
- /**
290
- * Define the custom font faces and set the --font-content to the custom font name
291
- */
292
- // function generateCustomFontFaces(customFont: CustomizationFontDefinition): string {
293
- // const { fontFamily, faces } = customFont;
294
- //
295
- // const regularFont = faces.find((face) => face.weight === 400);
296
- // const boldFont = faces.find((face) => face.weight === 700);
297
- //
298
- // if (!regularFont || !boldFont) {
299
- // throw new Error('Custom font must have a regular and a bold face');
300
- // }
301
- //
302
- // const regular = `
303
- // @font -face {
304
- // font-family: ${fontFamily};
305
- // font-style: normal;
306
- // font-weight: ${regularFont.weight};
307
- // font-display: swap;
308
- // src: url(${regularFont.url});
309
- // }
310
- // `;
311
- //
312
- // // const semiBold = `
313
- // // @font -face {
314
- // // font-family: ${fontFamily};
315
- // // font-style: normal;
316
- // // font-weight: 600;
317
- // // font-display: swap;
318
- // // src: url(${boldFont.url});
319
- // // }
320
- // // `
321
- // // : "";
322
- //
323
- // const bold = `
324
- // @font -face {
325
- // font-family: ${fontFamily};
326
- // font-style: normal;
327
- // font-weight: ${boldFont.weight};
328
- // font-display: swap;
329
- // src: url(${boldFont.url});
330
- // }
331
- // `;
332
- //
333
- // return `
334
- // ${regular}
335
- // ${bold}
336
- // :root {
337
- // --font-content: ${fontFamily};
338
- // }
339
- // `;
340
- // }
279
+
341
280
type ColorInput = string ;
342
281
function generateColorVariable (
343
282
name : string ,
0 commit comments