Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eb1d10b

Browse files
committedMar 14, 2025·
clean up
1 parent bae415c commit eb1d10b

File tree

3 files changed

+6
-66
lines changed

3 files changed

+6
-66
lines changed
 

‎packages/gitbook/src/components/RootLayout/CustomizationRootLayout.tsx

+3-63
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,7 @@ import {
2222
} from '@gitbook/colors';
2323
import { IconStyle, IconsProvider } from '@gitbook/icons';
2424

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';
3426
import { getSpaceLanguage } from '@/intl/server';
3527
import { getAssetURL } from '@/lib/assets';
3628
import { tcls } from '@/lib/tailwind';
@@ -77,7 +69,7 @@ export async function CustomizationRootLayout(props: {
7769
sidebarStyles.list && `sidebar-list-${sidebarStyles.list}`,
7870
'links' in customization.styling && `links-${customization.styling.links}`,
7971
fontNotoColorEmoji.variable,
80-
!fontData.isCustom ? fontData.fontVariable : '', // Only use fontVariable for default fonts
72+
fontData.isCustom ? 'font-content' : fontData.fontVariable,
8173
ibmPlexMono.variable
8274
)}
8375
>
@@ -150,7 +142,6 @@ export async function CustomizationRootLayout(props: {
150142
<body
151143
className={tcls(
152144
fontNotoColorEmoji.className,
153-
hasCustomFont ? 'font-sans' : fonts[customization.styling.font].className,
154145
`${ibmPlexMono.variable}`,
155146
'bg-tint-base',
156147
'theme-muted:bg-tint-subtle',
@@ -286,58 +277,7 @@ function getSemanticColors(
286277
},
287278
};
288279
}
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-
// }
280+
341281
type ColorInput = string;
342282
function generateColorVariable(
343283
name: string,

‎packages/gitbook/src/fonts/customFont.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { describe, test, expect } from 'bun:test';
1+
import { describe, expect, test } from 'bun:test';
2+
import stylelint from 'stylelint';
23
import {
34
type CustomizationFontDefinition,
45
generateFontFacesCSS,
56
getCustomFontSources,
67
} from './customFonts';
7-
import stylelint from 'stylelint';
88

99
const TEST_FONTS = {
1010
basic: {

‎packages/gitbook/tailwind.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const config: Config = {
7272
'current-page': 'current="page"',
7373
},
7474
fontFamily: {
75-
sans: ['var(--font-content)', 'arial', 'sans-serif'],
75+
content: ['var(--font-content)', 'arial', 'sans-serif'],
7676
mono: ['var(--font-mono)'],
7777
emoji: [
7878
'Apple Color Emoji',

0 commit comments

Comments
 (0)
Please sign in to comment.