Skip to content

Commit

Permalink
Improve emoji setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Jan 8, 2025
1 parent c1e27cc commit 49219df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-jars-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gitbook': patch
---

Improve emoji setup, align with GitBook app
8 changes: 0 additions & 8 deletions packages/gitbook/src/components/RootLayout/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

@layer base {
:root {
/* See packages/gitbook/src/fonts/index.ts */
--font-emoji: 'Apple Color Emoji', var(--font-noto-color-emoji);
--scrollbar-width: calc(100vw - 100%);

--dark-base: 20 20 20;
Expand Down Expand Up @@ -194,9 +192,3 @@ html {
html.dark {
color-scheme: dark light;
}

/* Emojis */

[class*='emoji'] {
font-family: var(--font-emoji);
}
4 changes: 2 additions & 2 deletions packages/gitbook/src/components/primitives/Emoji/Emoji.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { ClassValue, tcls } from '@/lib/tailwind';

/**
* Render an emoji by its codepoint.
* It renders the UTF-8 character and use the emojione font to display it (fallbacking to default browser font).
* It renders the UTF-8 character and use Emoji font defined in Tailwind CSS.
*/
export async function Emoji(props: { code: string; style?: ClassValue }) {
const { code, style } = props;

const fallback = getEmojiForCode(code);
return <span className={tcls('emoji', style)}>{fallback}</span>;
return <span className={tcls('font-emoji', style)}>{fallback}</span>;
}
6 changes: 6 additions & 0 deletions packages/gitbook/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ const config: Config = {
fontFamily: {
sans: ['var(--font-content)'],
mono: ['var(--font-mono)'],
emoji: [
'Apple Color Emoji',
'Noto Color Emoji',
'--font-noto-color-emoji',
'sans-serif',
],
var: ['var(--font-family)'],
},
colors: {
Expand Down

0 comments on commit 49219df

Please sign in to comment.