Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions docs/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/*
* Roboto Mono has no box-drawing characters (│ └ ─ ...). next/font puts its
* generated "Roboto Mono Fallback" (a resized Arial) right after it, so that
* would draw them, too wide for the grid. This face covers only that range,
* from a system monospace font at the same width, and goes first in the mono
* stack. Everything else falls through to Roboto Mono.
* Roboto Mono has no box-drawing characters (│ └ ─ ...), and Scraps' mono
* fallback only has them where Andale Mono or Courier New is installed. This
* face covers only that range, from a system monospace font at Roboto Mono's
* width (Scraps sizes it to 98.46%), and goes first in the theme's mono stack
* (components/themeContext.tsx), so diagrams line up everywhere.
*/
@font-face {
font-family: 'Mono Box Drawing';
src: local('Menlo Regular'), local('Menlo-Regular'), local('Menlo'), local('Monaco'),
local('DejaVu Sans Mono'), local('Consolas');
size-adjust: 98.46154%;
unicode-range: U+2500-257F;
}

Expand All @@ -25,12 +26,5 @@ html {

body {
margin: 0;
font-family: var(--font-rubik), 'Avenir Next', sans-serif;
font-size: 14px;
}

pre,
code,
kbd {
font-family: 'Mono Box Drawing', var(--font-roboto-mono), Monaco, Consolas, monospace;
}
6 changes: 1 addition & 5 deletions docs/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import type {Metadata} from 'next';
import {cookies} from 'next/headers';
import {Roboto_Mono, Rubik} from 'next/font/google';

import {DocsShell} from '@/components/docsShell';
import {Providers} from '@/components/providers';
import {LANGUAGE_COOKIE} from '@/components/languages';
import {modeFromCookie, THEME_COOKIE} from '@/components/themeMode';

import '@sentry/scraps/fonts.css';
import './globals.css';

const rubik = Rubik({subsets: ['latin'], variable: '--font-rubik'});
const robotoMono = Roboto_Mono({subsets: ['latin'], variable: '--font-roboto-mono'});

export const metadata: Metadata = {
title: {default: 'eac docs', template: '%s · eac docs'},
description: 'Define evals as code and run them with one CLI.',
Expand All @@ -24,7 +21,6 @@ export default async function RootLayout({children}: {children: React.ReactNode}
return (
<html
lang="en"
className={`${rubik.variable} ${robotoMono.variable}`}
style={{colorScheme: modeFromCookie(themeCookie)}}
>
<body>
Expand Down
21 changes: 9 additions & 12 deletions docs/components/themeContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,22 @@ import {darkTheme, lightTheme} from '@sentry/scraps/theme';

import {isExplicitChoice, modeFromCookie, THEME_COOKIE, type ThemeMode} from './themeMode';

// Scraps' theme names its fonts directly, while next/font serves them under
// generated names, so point the theme at the CSS variables next/font sets.
// The theme types each family as a string literal, hence the cast.
function withFonts(theme: typeof lightTheme): typeof lightTheme {
// 'Mono Box Drawing' (app/globals.css) supplies the box-drawing glyphs Roboto
// Mono lacks, at the same width, so diagrams line up. The theme types each
// family as a string literal, hence the cast.
function withBoxDrawing(theme: typeof lightTheme): typeof lightTheme {
return {
...theme,
font: {
...theme.font,
family: {
sans: `var(--font-rubik), ${theme.font.family.sans}`,
// 'Mono Box Drawing' (app/globals.css) supplies the box-drawing
// glyphs Roboto Mono lacks, at the same width, so diagrams line up.
mono: `'Mono Box Drawing', var(--font-roboto-mono), Menlo, ${theme.font.family.mono}`,
},
family: {...theme.font.family, mono: `'Mono Box Drawing', ${theme.font.family.mono}`},
},
} as unknown as typeof lightTheme;
}

export const THEMES = {
light: withFonts(lightTheme),
dark: withFonts(darkTheme as unknown as typeof lightTheme),
light: withBoxDrawing(lightTheme),
dark: withBoxDrawing(darkTheme as unknown as typeof lightTheme),
};

const ThemeModeContext = createContext<{mode: ThemeMode; toggle: () => void}>({
Expand Down Expand Up @@ -86,6 +81,8 @@ export function ThemeModeProvider({
colorScheme: mode,
background: theme.tokens.background.primary,
},
body: {fontFamily: theme.font.family.sans},
'pre, code, kbd': {fontFamily: theme.font.family.mono},
}}
/>
{children}
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@mdx-js/react": "^3.1.1",
"@next/mdx": "^16.4.6",
"@sentry/icons": "^0.1.0",
"@sentry/scraps": "^0.5.0",
"@sentry/scraps": "^0.6.0",
"next": "^16.4.6",
"react": "^19.3.1",
"react-dom": "^19.3.1"
Expand Down
Loading
Loading