mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-11-30 04:39:04 +00:00
Compare commits
50 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b7d177efe | |||
| 128ad20280 | |||
| 994ebff8c1 | |||
| 142938401c | |||
| 65cc4afb23 | |||
| e000f23c44 | |||
| 1de9d1aa33 | |||
| 0e601e277b | |||
| e582a47f37 | |||
| 1b251a78b0 | |||
| 24f5249ae9 | |||
| 17c1631013 | |||
| cb100d5e00 | |||
| 1fcc807513 | |||
| 5664e5a30f | |||
| 26e64019d8 | |||
| 56331d2e74 | |||
| 55b095e503 | |||
| 6a073e1dd5 | |||
| 960e25a3f6 | |||
| 1de338c312 | |||
| dbba50cea4 | |||
| 8f046a9cd6 | |||
| 2906e6038a | |||
| 87b8ea8c05 | |||
| 47971dce31 | |||
| 528a05398c | |||
| f584148ab9 | |||
| 0de22f7a96 | |||
| 09c7c30779 | |||
| fde32e26bf | |||
| a6f65916f1 | |||
| 6059efe094 | |||
| 16194c50ba | |||
| af3c6a971c | |||
| ecfdb976a3 | |||
| 08acea651a | |||
| 6b503608cd | |||
| d8763997a5 | |||
| 32aa1f99c1 | |||
| 718a8a54b1 | |||
| 741dd490d4 | |||
| 02d876e6d8 | |||
| 56c52e0bb0 | |||
| 6036becf93 | |||
| 3a7210d514 | |||
| 6088fa582d | |||
| 6691492ef7 | |||
| 7ee9158cd3 | |||
| 5ae1b883ab |
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix UI search without ask AI enabled and fix error with questions not returned from API
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix search no results error showing while there are results
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': minor
|
||||
---
|
||||
|
||||
Reintroduce a safety check around search whilst we continue investigating caching.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Apply antialiasing on any text that are not code inline/blocks to avoid contrast issues
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Handle security issue with cookies on Safari
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': minor
|
||||
---
|
||||
|
||||
Investigate an issue causing caches to return empty objects instead of null/undefined.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix vertical section overflow color
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix shrinking page icons
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Start using tint in more places, TOC and PageAside
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Remove KV cache backend and only rely on DO as an external cache backend
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Simplify search results logic to investigate a bug
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Try to fix error on og image generation
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Downgrade to Next.js v14 to fix incompatibilities with next-on-pages causing multiple bugs.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix zoom image view transition on Safari
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Position the variant picker in the ToC
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Handle Firefox security error on localStorage
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix errors from customization not found
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix OG image generation for non-latin characters
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Ignore cache invalidation error from local backend
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Allow only good values for theme query parameter. Avoid having a 500 error when we pass an invalid value.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': minor
|
||||
---
|
||||
|
||||
Restyle PageAside to use sidebar list styles
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': minor
|
||||
---
|
||||
|
||||
Fix an issue where search and Ask AI triggers unnecessary renders when in a Visitor Authenticated site.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix server actions stability leading to no results found sometimes on search
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix search UI behaviour
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix error when accessing a change request not found
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix issue leading to increase the storage write and the stability of the platform
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Force route handler to be dynamic to avoid errors
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': minor
|
||||
---
|
||||
|
||||
Add antialiasing for text rendering
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Improve styling of header buttons with shadows and high-contrast styles
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix viewing PDF from space
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Vertical orientation for sections list on sites without header
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix error when accessing some not found pages.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix breadcrumbs emoji display + add contrast styles
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix server actions cache compromised. Leading to some bugs on frontend.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix variant dropdown styling in header
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix view transition error on Safari
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Bump `heading-3` font size to offset it from paragraphs
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Remove animation on section tabs. Page is reloaded (for technical reasons), so the animation is not accurate here.
|
||||
@@ -41,6 +41,7 @@ jobs:
|
||||
run: bun run build:cloudflare
|
||||
env:
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: ${{ secrets.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY }}
|
||||
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
|
||||
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
|
||||
SENTRY_DSN: ${{ vars.SENTRY_DSN }}
|
||||
|
||||
@@ -8,3 +8,6 @@ packages/icons/src/data/*.json
|
||||
|
||||
# Build files
|
||||
dist/
|
||||
|
||||
README.md
|
||||
CHANGELOG.md
|
||||
+3
-1
@@ -8,7 +8,9 @@
|
||||
},
|
||||
"packageManager": "bun@1.1.18",
|
||||
"overrides": {
|
||||
"@codemirror/state": "6.4.1"
|
||||
"@codemirror/state": "6.4.1",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1"
|
||||
},
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -27,12 +27,40 @@ import { getContentTestURL } from '../tests/utils';
|
||||
|
||||
interface Test {
|
||||
name: string;
|
||||
url: string; // URL to visit for testing
|
||||
/**
|
||||
* URL to visit for testing.
|
||||
*/
|
||||
url: string;
|
||||
cookies?: Parameters<BrowserContext['addCookies']>[0];
|
||||
run?: (page: Page) => Promise<unknown>; // The test to run
|
||||
fullPage?: boolean; // Whether the test should be fullscreened during testing
|
||||
screenshot?: false; // Should a screenshot be stored
|
||||
only?: boolean; // Only run this test
|
||||
/**
|
||||
* Test to run
|
||||
*/
|
||||
run?: (page: Page) => Promise<unknown>;
|
||||
/**
|
||||
* Whether the test should be fullscreened during testing.
|
||||
*/
|
||||
fullPage?: boolean;
|
||||
/**
|
||||
* Whether to take a screenshot of the test or set a threshold for the screenshot.
|
||||
*/
|
||||
screenshot?:
|
||||
| false
|
||||
| {
|
||||
/**
|
||||
* Screenshot threshold.
|
||||
* From 0 to 1, where 0 is the most strict and 1 is the most permissive.
|
||||
* @default 0.5
|
||||
*/
|
||||
threshold?: number;
|
||||
/**
|
||||
* Whether to wait for the table of contents to finish scrolling before taking the screenshot.
|
||||
*/
|
||||
waitForTOCScrolling?: boolean;
|
||||
};
|
||||
/**
|
||||
* Whether to only run this test.
|
||||
*/
|
||||
only?: boolean;
|
||||
}
|
||||
|
||||
interface TestsCase {
|
||||
@@ -95,19 +123,26 @@ const testCases: TestsCase[] = [
|
||||
{
|
||||
name: 'Search',
|
||||
url: '?q=',
|
||||
screenshot: false,
|
||||
run: async (page) => {
|
||||
await expect(page.getByTestId('search-results')).toBeVisible();
|
||||
const allItems = await page.getByTestId('search-result-item').all();
|
||||
// Expect at least 3 questions
|
||||
await expect(allItems.length).toBeGreaterThan(2);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Search Results',
|
||||
url: '?q=gitbook',
|
||||
run: async (page) => {
|
||||
await page.waitForSelector('[data-test="search-results"]');
|
||||
await expect(page.getByTestId('search-results')).toBeVisible();
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'AI Search',
|
||||
url: '?q=What+is+GitBook%3F&ask=true',
|
||||
run: async (page) => {
|
||||
await page.waitForSelector('[data-test="search-ask-answer"]');
|
||||
await expect(page.getByTestId('search-ask-answer')).toBeVisible();
|
||||
},
|
||||
screenshot: false,
|
||||
},
|
||||
@@ -268,19 +303,26 @@ const testCases: TestsCase[] = [
|
||||
{
|
||||
name: 'Search',
|
||||
url: '?q=',
|
||||
screenshot: false,
|
||||
run: async (page) => {
|
||||
await expect(page.getByTestId('search-results')).toBeVisible();
|
||||
const allItems = await page.getByTestId('search-result-item').all();
|
||||
// Expect at least 3 questions
|
||||
await expect(allItems.length).toBeGreaterThan(2);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Search Results',
|
||||
url: '?q=gitbook',
|
||||
run: async (page) => {
|
||||
await page.waitForSelector('[data-test="search-results"]');
|
||||
await expect(page.getByTestId('search-results')).toBeVisible();
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'AI Search',
|
||||
url: '?q=What+is+GitBook%3F&ask=true',
|
||||
run: async (page) => {
|
||||
await page.waitForSelector('[data-test="search-ask-answer"]');
|
||||
await expect(page.getByTestId('search-ask-answer')).toBeVisible();
|
||||
},
|
||||
screenshot: false,
|
||||
},
|
||||
@@ -309,6 +351,9 @@ const testCases: TestsCase[] = [
|
||||
{
|
||||
name: 'PDF',
|
||||
url: '~gitbook/pdf?limit=10',
|
||||
screenshot: {
|
||||
waitForTOCScrolling: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -331,11 +376,13 @@ const testCases: TestsCase[] = [
|
||||
url: 'blocks/block-images',
|
||||
run: waitForCookiesDialog,
|
||||
fullPage: true,
|
||||
screenshot: { threshold: 0.8 },
|
||||
},
|
||||
{
|
||||
name: 'Inline Images',
|
||||
url: 'blocks/inline-images',
|
||||
run: waitForCookiesDialog,
|
||||
screenshot: { threshold: 0.8 },
|
||||
},
|
||||
{
|
||||
name: 'Tabs',
|
||||
@@ -406,6 +453,18 @@ const testCases: TestsCase[] = [
|
||||
{
|
||||
name: 'Math',
|
||||
url: 'blocks/math',
|
||||
run: async (page) => {
|
||||
await page.waitForFunction(() => {
|
||||
const fonts = Array.from(document.fonts.values());
|
||||
const mjxFonts = fonts.filter(
|
||||
(font) => font.family === 'MJXZERO' || font.family === 'MJXTEX',
|
||||
);
|
||||
return (
|
||||
mjxFonts.length === 2 &&
|
||||
mjxFonts.every((font) => font.status === 'loaded')
|
||||
);
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Files',
|
||||
@@ -459,6 +518,9 @@ const testCases: TestsCase[] = [
|
||||
name: 'With cover and no TOC',
|
||||
url: 'page-options/page-with-cover-and-no-toc',
|
||||
run: waitForCookiesDialog,
|
||||
screenshot: {
|
||||
waitForTOCScrolling: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'With icon',
|
||||
@@ -642,11 +704,14 @@ const testCases: TestsCase[] = [
|
||||
run: async (page) => {
|
||||
const sharedSpaceLink = page.locator('a.underline');
|
||||
await sharedSpaceLink.click();
|
||||
expect(page.locator('h1')).toHaveText('shared');
|
||||
await expect(
|
||||
page.getByRole('heading', { level: 1, name: 'shared' }),
|
||||
).toBeVisible();
|
||||
const url = page.url();
|
||||
expect(url.includes('shared-space-uno')).toBeTruthy(); // same uno site
|
||||
expect(url.endsWith('/shared')).toBeTruthy(); // correct page
|
||||
},
|
||||
screenshot: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -658,13 +723,15 @@ const testCases: TestsCase[] = [
|
||||
name: 'Navigation to shared space',
|
||||
url: '',
|
||||
run: async (page) => {
|
||||
const sharedSpaceLink = page.locator('a.underline');
|
||||
await sharedSpaceLink.click();
|
||||
expect(page.locator('h1')).toHaveText('shared');
|
||||
await page.locator('a.underline').click();
|
||||
await expect(
|
||||
page.getByRole('heading', { level: 1, name: 'shared' }),
|
||||
).toBeVisible();
|
||||
const url = page.url();
|
||||
expect(url.includes('shared-space-dos')).toBeTruthy(); // same dos site
|
||||
expect(url.endsWith('/shared')).toBeTruthy(); // correct page
|
||||
},
|
||||
screenshot: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -678,6 +745,7 @@ const testCases: TestsCase[] = [
|
||||
run: async (page) => {
|
||||
await expect(page.locator('h1')).toHaveText('SSO');
|
||||
},
|
||||
screenshot: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -697,6 +765,7 @@ const testCases: TestsCase[] = [
|
||||
page.getByText('Authentication missing to access this content'),
|
||||
).toBeVisible();
|
||||
},
|
||||
screenshot: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -719,7 +788,12 @@ const testCases: TestsCase[] = [
|
||||
);
|
||||
return `first?jwt_token=${token}`;
|
||||
})(),
|
||||
run: waitForCookiesDialog,
|
||||
run: async (page) => {
|
||||
await expect(
|
||||
page.getByRole('heading', { level: 1, name: 'first' }),
|
||||
).toBeVisible();
|
||||
},
|
||||
screenshot: false,
|
||||
},
|
||||
{
|
||||
name: 'Second',
|
||||
@@ -736,7 +810,12 @@ const testCases: TestsCase[] = [
|
||||
);
|
||||
return `second?jwt_token=${token}`;
|
||||
})(),
|
||||
run: waitForCookiesDialog,
|
||||
run: async (page) => {
|
||||
await expect(
|
||||
page.getByRole('heading', { level: 1, name: 'second' }),
|
||||
).toBeVisible();
|
||||
},
|
||||
screenshot: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -850,7 +929,12 @@ const testCases: TestsCase[] = [
|
||||
);
|
||||
return `first?jwt_token=${token}`;
|
||||
})(),
|
||||
run: waitForCookiesDialog,
|
||||
run: async (page) => {
|
||||
await expect(
|
||||
page.getByRole('heading', { level: 1, name: 'first' }),
|
||||
).toBeVisible();
|
||||
},
|
||||
screenshot: false,
|
||||
},
|
||||
{
|
||||
name: 'Custom page',
|
||||
@@ -1346,16 +1430,24 @@ for (const testCase of testCases) {
|
||||
if (testEntry.run) {
|
||||
await testEntry.run(page);
|
||||
}
|
||||
if (testEntry.screenshot !== false) {
|
||||
const screenshotOptions = testEntry.screenshot;
|
||||
if (screenshotOptions !== false) {
|
||||
await argosScreenshot(page, `${testCase.name} - ${testEntry.name}`, {
|
||||
viewports: ['macbook-16', 'macbook-13', 'iphone-x', 'ipad-2'],
|
||||
viewports: ['macbook-16', 'macbook-13', 'ipad-2', 'iphone-x'],
|
||||
argosCSS: `
|
||||
/* Hide Intercom */
|
||||
.intercom-lightweight-app {
|
||||
display: none !important;
|
||||
}
|
||||
`,
|
||||
}
|
||||
`,
|
||||
threshold: screenshotOptions?.threshold ?? undefined,
|
||||
fullPage: testEntry.fullPage ?? false,
|
||||
beforeScreenshot: async () => {
|
||||
await waitForIcons(page);
|
||||
if (screenshotOptions?.waitForTOCScrolling !== false) {
|
||||
await waitForTOCScrolling(page);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1433,3 +1525,53 @@ function getCustomizationURL(partial: DeepPartial<SiteCustomizationSettings>): s
|
||||
|
||||
return `?${searchParams.toString()}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for all icons present on the page to be loaded.
|
||||
*/
|
||||
async function waitForIcons(page: Page) {
|
||||
await page.waitForFunction(async () => {
|
||||
function loadImage(src: string) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const img = new Image();
|
||||
img.onload = () => resolve(img);
|
||||
img.onerror = (error) => reject(new Error(`Failed to load image: ${src}`));
|
||||
img.src = src;
|
||||
});
|
||||
}
|
||||
|
||||
const icons = Array.from(document.querySelectorAll('svg.gb-icon'));
|
||||
await Promise.all(
|
||||
icons.map(async (icon) => {
|
||||
// url("https://ka-p.fontawesome.com/releases/v6.6.0/svgs/light/moon.svg?v=2&token=a463935e93")
|
||||
const maskImage = window.getComputedStyle(icon).getPropertyValue('mask-image');
|
||||
const urlMatch = maskImage.match(/url\("([^"]+)"\)/);
|
||||
const url = urlMatch ? urlMatch[1] : null;
|
||||
if (!url) {
|
||||
throw new Error('No mask-image');
|
||||
}
|
||||
await loadImage(url);
|
||||
}),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for TOC to be correctly scrolled into view.
|
||||
*/
|
||||
async function waitForTOCScrolling(page: Page) {
|
||||
const viewport = await page.viewportSize();
|
||||
if (viewport && viewport.width >= 1024) {
|
||||
const toc = page.getByTestId('table-of-contents');
|
||||
await expect(toc).toBeVisible();
|
||||
await page.evaluate(() => {
|
||||
const tocScrollContainer = document.querySelector(
|
||||
'[data-testid="table-of-contents"] [data-testid="toc-scroll-container"]',
|
||||
);
|
||||
if (!tocScrollContainer) {
|
||||
throw new Error('TOC scroll container not found');
|
||||
}
|
||||
tocScrollContainer.scrollTo(0, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ module.exports = withSentryConfig(
|
||||
GITBOOK_ASSETS_PREFIX: process.env.GITBOOK_ASSETS_PREFIX,
|
||||
GITBOOK_ICONS_URL: process.env.GITBOOK_ICONS_URL,
|
||||
GITBOOK_ICONS_TOKEN: process.env.GITBOOK_ICONS_TOKEN,
|
||||
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY,
|
||||
},
|
||||
|
||||
webpack(config, { dev, webpack }) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"clean": "rm -rf ./.next && rm -rf ./public/~gitbook/static"
|
||||
},
|
||||
"dependencies": {
|
||||
"@gitbook/api": "^0.85.0",
|
||||
"@gitbook/api": "^0.87.0",
|
||||
"@gitbook/cache-do": "workspace:*",
|
||||
"@gitbook/emoji-codepoints": "workspace:*",
|
||||
"@gitbook/icons": "workspace:*",
|
||||
@@ -41,7 +41,7 @@
|
||||
"katex": "^0.16.9",
|
||||
"mathjax": "^3.2.2",
|
||||
"memoizee": "^0.4.15",
|
||||
"next": "15.1.3",
|
||||
"next": "14.2.15",
|
||||
"next-themes": "^0.2.1",
|
||||
"nuqs": "^2.2.3",
|
||||
"object-hash": "^3.0.0",
|
||||
@@ -49,8 +49,8 @@
|
||||
"p-map": "^7.0.0",
|
||||
"parse-cache-control": "^1.0.1",
|
||||
"postcss-color-contrast": "^1.1.0",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"react-hotkeys-hook": "^4.4.1",
|
||||
"rehype-sanitize": "^6.0.0",
|
||||
"rehype-stringify": "^10.0.0",
|
||||
@@ -67,10 +67,10 @@
|
||||
"usehooks-ts": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@argos-ci/playwright": "^2.0.0",
|
||||
"@argos-ci/playwright": "^3.10.0",
|
||||
"@cloudflare/next-on-pages": "1.13.7",
|
||||
"@cloudflare/workers-types": "^4.20241230.0",
|
||||
"@playwright/test": "^1.42.1",
|
||||
"@playwright/test": "^1.49.1",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@types/jsontoxml": "^1.0.5",
|
||||
"@types/jsonwebtoken": "^9.0.6",
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { init } from '@sentry/nextjs';
|
||||
|
||||
const dsn = process.env.SENTRY_DSN;
|
||||
if (dsn) {
|
||||
init({
|
||||
dsn,
|
||||
release: process.env.SENTRY_RELEASE,
|
||||
|
||||
// Disable tracing as it creates additional requests in an env where subrequests are limited.
|
||||
tracesSampleRate: 0,
|
||||
|
||||
// Disable transactions as it creates additional requests in an env where subrequests are limited.
|
||||
// https://docs.sentry.io/platforms/node/configuration/filtering/#using--3
|
||||
beforeSendTransaction: () => {
|
||||
return null;
|
||||
},
|
||||
});
|
||||
}
|
||||
+1
@@ -15,6 +15,7 @@ import { PageClientLayout } from './PageClientLayout';
|
||||
import { PagePathParams, fetchPageData, getPathnameParam, normalizePathname } from '../../fetch';
|
||||
|
||||
export const runtime = 'edge';
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
/**
|
||||
* Fetch and render a page.
|
||||
+1
@@ -22,6 +22,7 @@ import { RocketLoaderDetector } from './RocketLoaderDetector';
|
||||
import { fetchContentData } from '../fetch';
|
||||
|
||||
export const runtime = 'edge';
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
/**
|
||||
* Layout when rendering the content.
|
||||
+86
-75
@@ -5,44 +5,97 @@ import { NextRequest } from 'next/server';
|
||||
import colorContrast from 'postcss-color-contrast/js';
|
||||
import React from 'react';
|
||||
|
||||
import { googleFontsMap } from '@/fonts';
|
||||
import { getAbsoluteHref } from '@/lib/links';
|
||||
import { tcls } from '@/lib/tailwind';
|
||||
import { filterOutNullable } from '@/lib/typescript';
|
||||
import { getContentTitle } from '@/lib/utils';
|
||||
|
||||
import { PageIdParams, fetchPageData } from '../../../../fetch';
|
||||
|
||||
export const runtime = 'edge';
|
||||
|
||||
async function loadGoogleFont(input: { fontFamily: string; text: string; weight: 400 | 700 }) {
|
||||
const { fontFamily, text, weight } = input;
|
||||
|
||||
if (!text.trim()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const url = new URL('https://fonts.googleapis.com/css2');
|
||||
url.searchParams.set('family', `${fontFamily}:wght@${weight}`);
|
||||
url.searchParams.set('text', text);
|
||||
|
||||
const result = await fetch(url.href);
|
||||
|
||||
if (!result.ok) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const css = await result.text();
|
||||
const resource = css.match(/src: url\((.+)\) format\('(opentype|truetype)'\)/);
|
||||
const resourceUrl = resource ? resource[1] : null;
|
||||
|
||||
if (resourceUrl) {
|
||||
const response = await fetch(resourceUrl);
|
||||
if (response.ok) {
|
||||
const data = await response.arrayBuffer();
|
||||
return {
|
||||
name: fontFamily,
|
||||
data,
|
||||
style: 'normal' as const,
|
||||
weight,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// If for some reason we can't load the font, we'll just use the default one
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the OpenGraph image for a space.
|
||||
*/
|
||||
export async function GET(req: NextRequest, { params }: { params: Promise<PageIdParams> }) {
|
||||
const { space, page, customization, site } = await fetchPageData(await params);
|
||||
|
||||
// If user configured a custom social preview, we redirect to it.
|
||||
if (customization.socialPreview.url) {
|
||||
// If user configured a custom social preview, we redirect to it.
|
||||
redirect(customization.socialPreview.url);
|
||||
}
|
||||
|
||||
// TODO: Support all fonts available in GitBook
|
||||
// Right now this is impossible since next/font/google does not expose the cached font file
|
||||
// Another option would be to use the Satori prop `loadAdditionalAsset` [example](https://github.com/vercel/satori/blob/main/playground/pages/index.tsx),
|
||||
// but this prop isn't (yet) exposed through `ImageResponse`.
|
||||
const interRegular = await fetch(
|
||||
new URL('../../../../../../fonts/Inter/Inter-Regular.ttf', import.meta.url),
|
||||
).then((res) => res.arrayBuffer());
|
||||
const interBold = await fetch(
|
||||
new URL('../../../../../../fonts/Inter/Inter-Bold.ttf', import.meta.url),
|
||||
).then((res) => res.arrayBuffer());
|
||||
// Compute all text to load only the necessary fonts
|
||||
const contentTitle = customization.header.logo
|
||||
? ''
|
||||
: getContentTitle(space, customization, site ?? null);
|
||||
const pageTitle = page
|
||||
? page.title.length > 64
|
||||
? page.title.slice(0, 64) + '...'
|
||||
: page.title
|
||||
: 'Not found';
|
||||
const pageDescription =
|
||||
page?.description && page?.title.length <= 64
|
||||
? page.description.length > 164
|
||||
? page.description.slice(0, 164) + '...'
|
||||
: page.description
|
||||
: '';
|
||||
|
||||
const fontFamily = googleFontsMap[customization.styling.font] ?? 'Inter';
|
||||
|
||||
const regularText = pageDescription;
|
||||
const boldText = `${contentTitle}${pageTitle}`;
|
||||
|
||||
const fonts = (
|
||||
await Promise.all([
|
||||
loadGoogleFont({ fontFamily, text: regularText, weight: 400 }),
|
||||
loadGoogleFont({ fontFamily, text: boldText, weight: 700 }),
|
||||
])
|
||||
).filter(filterOutNullable);
|
||||
|
||||
const theme = customization.themes.default;
|
||||
const useLightTheme = theme === 'light';
|
||||
|
||||
// We have no access to CSS variables, so we'll have to hardcode some values
|
||||
const baseColors = {
|
||||
light: '#ffffff',
|
||||
dark: '#111827',
|
||||
};
|
||||
const baseColors = { light: '#ffffff', dark: '#111827' };
|
||||
|
||||
let colors = {
|
||||
background: baseColors[theme],
|
||||
@@ -99,13 +152,13 @@ export async function GET(req: NextRequest, { params }: { params: Promise<PageId
|
||||
src={customization.favicon.icon[theme]}
|
||||
width={40}
|
||||
height={40}
|
||||
tw={tcls('mr-4')}
|
||||
tw="mr-4"
|
||||
alt="Icon"
|
||||
/>
|
||||
);
|
||||
if ('emoji' in customization.favicon)
|
||||
return (
|
||||
<span tw={tcls('text-4xl', 'mr-4')}>
|
||||
<span tw="text-4xl mr-4">
|
||||
{String.fromCodePoint(parseInt('0x' + customization.favicon.emoji))}
|
||||
</span>
|
||||
);
|
||||
@@ -113,27 +166,20 @@ export async function GET(req: NextRequest, { params }: { params: Promise<PageId
|
||||
`~gitbook/icon?size=medium&theme=${customization.themes.default}`,
|
||||
true,
|
||||
);
|
||||
return <img src={src} alt="Icon" width={40} height={40} tw={tcls('mr-4')} />;
|
||||
return <img src={src} alt="Icon" width={40} height={40} tw="mr-4" />;
|
||||
})();
|
||||
|
||||
return new ImageResponse(
|
||||
(
|
||||
<div
|
||||
tw={tcls(
|
||||
'justify-between',
|
||||
'p-20',
|
||||
'relative',
|
||||
'w-full',
|
||||
'h-full',
|
||||
'flex',
|
||||
'flex-col',
|
||||
`bg-[${colors.background}]`,
|
||||
`text-[${colors.body}]`,
|
||||
)}
|
||||
tw={`justify-between p-20 relative w-full h-full flex flex-col bg-[${colors.background}] text-[${colors.body}]`}
|
||||
style={{
|
||||
fontFamily,
|
||||
}}
|
||||
>
|
||||
{/* Gradient */}
|
||||
<div
|
||||
tw={tcls('absolute', 'inset-0')}
|
||||
tw="absolute inset-0"
|
||||
style={{
|
||||
backgroundImage: `radial-gradient(ellipse 100% 100% at top right , ${colors.gradient}, ${colors.gradient}00)`,
|
||||
opacity: 0.5,
|
||||
@@ -141,11 +187,7 @@ export async function GET(req: NextRequest, { params }: { params: Promise<PageId
|
||||
></div>
|
||||
|
||||
{/* Grid */}
|
||||
<img
|
||||
tw={tcls('absolute', 'inset-0', 'w-[100vw]', 'h-[100vh]')}
|
||||
src={gridAsset}
|
||||
alt="Grid"
|
||||
/>
|
||||
<img tw="absolute inset-0 w-[100vw] h-[100vh]" src={gridAsset} alt="Grid" />
|
||||
|
||||
{/* Logo */}
|
||||
{customization.header.logo ? (
|
||||
@@ -159,39 +201,21 @@ export async function GET(req: NextRequest, { params }: { params: Promise<PageId
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<div tw={tcls('flex')}>
|
||||
<div tw="flex">
|
||||
{favicon}
|
||||
<h3 tw={tcls('text-4xl', 'my-0')}>
|
||||
{getContentTitle(space, customization, site ?? null)}
|
||||
</h3>
|
||||
<h3 tw="text-4xl my-0 font-bold">{contentTitle}</h3>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Title and description */}
|
||||
<div tw={tcls('flex', 'flex-col')}>
|
||||
<div tw="flex flex-col">
|
||||
<h1
|
||||
tw={tcls(
|
||||
'text-8xl',
|
||||
'my-0',
|
||||
'tracking-tight',
|
||||
'leading-none',
|
||||
'text-left',
|
||||
`text-[${colors.title}]`,
|
||||
'font-bold',
|
||||
)}
|
||||
tw={`text-8xl my-0 tracking-tight leading-none text-left text-[${colors.title}] font-bold`}
|
||||
>
|
||||
{page
|
||||
? page.title.length > 64
|
||||
? page.title.slice(0, 64) + '...'
|
||||
: page.title
|
||||
: 'Not found'}
|
||||
{pageTitle}
|
||||
</h1>
|
||||
{page?.description && page?.title.length <= 64 ? (
|
||||
<h2 tw={tcls('text-4xl', 'mb-0', 'mt-8', 'w-[75%]', 'font-normal')}>
|
||||
{page.description.length > 164
|
||||
? page.description.slice(0, 164) + '...'
|
||||
: page.description}
|
||||
</h2>
|
||||
{pageDescription ? (
|
||||
<h2 tw="text-4xl mb-0 mt-8 w-[75%] font-normal">{pageDescription}</h2>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
@@ -199,20 +223,7 @@ export async function GET(req: NextRequest, { params }: { params: Promise<PageId
|
||||
{
|
||||
width: 1200,
|
||||
height: 630,
|
||||
fonts: [
|
||||
{
|
||||
name: 'Inter',
|
||||
data: interRegular,
|
||||
weight: 400,
|
||||
style: 'normal',
|
||||
},
|
||||
{
|
||||
name: 'Inter',
|
||||
data: interBold,
|
||||
weight: 700,
|
||||
style: 'normal',
|
||||
},
|
||||
],
|
||||
fonts: fonts.length ? fonts : undefined,
|
||||
},
|
||||
);
|
||||
}
|
||||
+12
-4
@@ -37,6 +37,7 @@ import { PrintButton } from './PrintButton';
|
||||
const DEFAULT_LIMIT = 100;
|
||||
|
||||
export const runtime = 'edge';
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const pointer = await getSiteOrSpacePointerForPDF();
|
||||
@@ -58,10 +59,8 @@ export default async function PDFHTMLOutput(props: {
|
||||
searchParams: Promise<{ [key: string]: string }>;
|
||||
}) {
|
||||
const pointer = await getSiteOrSpacePointerForPDF();
|
||||
|
||||
const searchParams = new URLSearchParams(await props.searchParams);
|
||||
const pdfParams = getPDFSearchParams(new URLSearchParams(searchParams));
|
||||
|
||||
// Build current PDF URL and preserve all search params
|
||||
let currentPDFUrl = await getAbsoluteHref('~gitbook/pdf', true);
|
||||
currentPDFUrl += '?' + searchParams.toString();
|
||||
@@ -323,6 +322,16 @@ function selectPages(
|
||||
}),
|
||||
];
|
||||
};
|
||||
const range = (entries: FlatPageEntry[]) => {
|
||||
if(params.from !== undefined && params.to) {
|
||||
const sliced = entries.slice(params.from, params.to +1);
|
||||
return {
|
||||
pages: sliced,
|
||||
total: params.to - params.from + 1,
|
||||
};
|
||||
}
|
||||
return limitTo(entries)
|
||||
}
|
||||
|
||||
const limitTo = (entries: FlatPageEntry[]) => {
|
||||
return {
|
||||
@@ -331,7 +340,6 @@ function selectPages(
|
||||
total: entries.length,
|
||||
};
|
||||
};
|
||||
|
||||
if (params.page) {
|
||||
const found = resolvePageId(rootPages, params.page);
|
||||
if (!found) {
|
||||
@@ -356,5 +364,5 @@ function selectPages(
|
||||
|
||||
return flattenPage(page, 0);
|
||||
});
|
||||
return limitTo(allPages);
|
||||
return range(allPages);
|
||||
}
|
||||
+1
-1
@@ -12,7 +12,7 @@ export async function getSiteOrSpacePointerForPDF(): Promise<
|
||||
SiteContentPointer | SpaceContentPointer
|
||||
> {
|
||||
try {
|
||||
return getSiteContentPointer();
|
||||
return await getSiteContentPointer();
|
||||
} catch (error) {
|
||||
return getSpacePointer();
|
||||
}
|
||||
@@ -14,33 +14,7 @@ interface AdminToolbarProps {
|
||||
space: Space;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toolbar with information for the content admin when previewing a revision or change-request.
|
||||
*/
|
||||
export function AdminToolbar(props: AdminToolbarProps) {
|
||||
const { content } = props;
|
||||
|
||||
const toolbar = (() => {
|
||||
if (content.changeRequestId) {
|
||||
return (
|
||||
<ChangeRequestToolbar
|
||||
spaceId={content.spaceId}
|
||||
changeRequestId={content.changeRequestId}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (content.revisionId) {
|
||||
return <RevisionToolbar spaceId={content.spaceId} revisionId={content.revisionId} />;
|
||||
}
|
||||
|
||||
return null;
|
||||
})();
|
||||
|
||||
if (!toolbar) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function ToolbarLayout(props: { children: React.ReactNode }) {
|
||||
return (
|
||||
<div
|
||||
className={tcls(
|
||||
@@ -61,41 +35,68 @@ export function AdminToolbar(props: AdminToolbarProps) {
|
||||
'backdrop-blur-sm',
|
||||
)}
|
||||
>
|
||||
<React.Suspense fallback={null}>{toolbar}</React.Suspense>
|
||||
<React.Suspense fallback={null}>{props.children}</React.Suspense>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toolbar with information for the content admin when previewing a revision or change-request.
|
||||
*/
|
||||
export function AdminToolbar(props: AdminToolbarProps) {
|
||||
const { content } = props;
|
||||
if (content.changeRequestId) {
|
||||
return (
|
||||
<ChangeRequestToolbar
|
||||
spaceId={content.spaceId}
|
||||
changeRequestId={content.changeRequestId}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (content.revisionId) {
|
||||
return <RevisionToolbar spaceId={content.spaceId} revisionId={content.revisionId} />;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async function ChangeRequestToolbar(props: { spaceId: string; changeRequestId: string }) {
|
||||
const { spaceId, changeRequestId } = props;
|
||||
|
||||
const changeRequest = await getChangeRequest(spaceId, changeRequestId);
|
||||
|
||||
if (!changeRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Toolbar>
|
||||
<ToolbarButton title="Open in application" href={changeRequest.urls.app}>
|
||||
<Icon icon="code-branch" className="size-4" />
|
||||
</ToolbarButton>
|
||||
<ToolbarBody>
|
||||
<p>
|
||||
#{changeRequest.number}: {changeRequest.subject ?? 'No subject'}
|
||||
</p>
|
||||
<p className="text-xs text-light/8 dark:text-light/8">
|
||||
Change request updated <DateRelative value={changeRequest.updatedAt} />
|
||||
</p>
|
||||
</ToolbarBody>
|
||||
<ToolbarButtonGroups>
|
||||
<ToolbarLayout>
|
||||
<Toolbar>
|
||||
<ToolbarButton title="Open in application" href={changeRequest.urls.app}>
|
||||
<Icon icon="arrow-up-right-from-square" className="size-4" />
|
||||
<Icon icon="code-branch" className="size-4" />
|
||||
</ToolbarButton>
|
||||
<RefreshChangeRequestButton
|
||||
spaceId={spaceId}
|
||||
changeRequestId={changeRequestId}
|
||||
revisionId={changeRequest.revision}
|
||||
updatedAt={new Date(changeRequest.updatedAt).getTime()}
|
||||
/>
|
||||
</ToolbarButtonGroups>
|
||||
</Toolbar>
|
||||
<ToolbarBody>
|
||||
<p>
|
||||
#{changeRequest.number}: {changeRequest.subject ?? 'No subject'}
|
||||
</p>
|
||||
<p className="text-xs text-light/8 dark:text-light/8">
|
||||
Change request updated <DateRelative value={changeRequest.updatedAt} />
|
||||
</p>
|
||||
</ToolbarBody>
|
||||
<ToolbarButtonGroups>
|
||||
<ToolbarButton title="Open in application" href={changeRequest.urls.app}>
|
||||
<Icon icon="arrow-up-right-from-square" className="size-4" />
|
||||
</ToolbarButton>
|
||||
<RefreshChangeRequestButton
|
||||
spaceId={spaceId}
|
||||
changeRequestId={changeRequestId}
|
||||
revisionId={changeRequest.revision}
|
||||
updatedAt={new Date(changeRequest.updatedAt).getTime()}
|
||||
/>
|
||||
</ToolbarButtonGroups>
|
||||
</Toolbar>
|
||||
</ToolbarLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -107,31 +108,35 @@ async function RevisionToolbar(props: { spaceId: string; revisionId: string }) {
|
||||
});
|
||||
|
||||
return (
|
||||
<Toolbar>
|
||||
<ToolbarButton title="Open in application" href={revision.urls.app}>
|
||||
<Icon icon="code-commit" className="size-4" />
|
||||
</ToolbarButton>
|
||||
<ToolbarBody>
|
||||
<p>
|
||||
Revision created <DateRelative value={revision.createdAt} />
|
||||
</p>
|
||||
{revision.git ? (
|
||||
<p className="text-xs text-light/8 dark:text-light/8">{revision.git.message}</p>
|
||||
) : null}
|
||||
</ToolbarBody>
|
||||
<ToolbarButtonGroups>
|
||||
<ToolbarLayout>
|
||||
<Toolbar>
|
||||
<ToolbarButton title="Open in application" href={revision.urls.app}>
|
||||
<Icon icon="arrow-up-right-from-square" className="size-4" />
|
||||
<Icon icon="code-commit" className="size-4" />
|
||||
</ToolbarButton>
|
||||
{revision.git?.url ? (
|
||||
<ToolbarButton title="Open git commit" href={revision.git.url}>
|
||||
<Icon
|
||||
icon={revision.git.url.includes('github.com') ? 'github' : 'gitlab'}
|
||||
className="size-4"
|
||||
/>
|
||||
<ToolbarBody>
|
||||
<p>
|
||||
Revision created <DateRelative value={revision.createdAt} />
|
||||
</p>
|
||||
{revision.git ? (
|
||||
<p className="text-xs text-light/8 dark:text-light/8">
|
||||
{revision.git.message}
|
||||
</p>
|
||||
) : null}
|
||||
</ToolbarBody>
|
||||
<ToolbarButtonGroups>
|
||||
<ToolbarButton title="Open in application" href={revision.urls.app}>
|
||||
<Icon icon="arrow-up-right-from-square" className="size-4" />
|
||||
</ToolbarButton>
|
||||
) : null}
|
||||
</ToolbarButtonGroups>
|
||||
</Toolbar>
|
||||
{revision.git?.url ? (
|
||||
<ToolbarButton title="Open git commit" href={revision.git.url}>
|
||||
<Icon
|
||||
icon={revision.git.url.includes('github.com') ? 'github' : 'gitlab'}
|
||||
className="size-4"
|
||||
/>
|
||||
</ToolbarButton>
|
||||
) : null}
|
||||
</ToolbarButtonGroups>
|
||||
</Toolbar>
|
||||
</ToolbarLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,5 +11,8 @@ export async function hasContentBeenUpdated(props: {
|
||||
revisionId: string;
|
||||
}) {
|
||||
const changeRequest = await getChangeRequest.revalidate(props.spaceId, props.changeRequestId);
|
||||
if (!changeRequest) {
|
||||
return false;
|
||||
}
|
||||
return changeRequest.revision !== props.revisionId;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DocumentBlockContentRef } from '@gitbook/api';
|
||||
import { DocumentBlockContentRef, SiteInsightsLinkPosition } from '@gitbook/api';
|
||||
|
||||
import { Card } from '@/components/primitives';
|
||||
import { getSpaceCustomization, ignoreAPIError } from '@/lib/api';
|
||||
@@ -36,7 +36,7 @@ export async function BlockContentRef(props: BlockProps<DocumentBlockContentRef>
|
||||
style={style}
|
||||
insights={{
|
||||
target: block.data.ref,
|
||||
position: 'content',
|
||||
position: SiteInsightsLinkPosition.Content,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -34,16 +34,9 @@ export function Caption(
|
||||
wrapperStyle = [
|
||||
'relative',
|
||||
'overflow-hidden',
|
||||
'rounded',
|
||||
'straight-corners:rounded-none',
|
||||
'after:block',
|
||||
'after:absolute',
|
||||
'after:-inset-[0]',
|
||||
'after:border-dark/2',
|
||||
'after:border',
|
||||
'after:rounded',
|
||||
'straight-corners:after:rounded-none',
|
||||
'dark:after:border-light/1',
|
||||
'dark:after:mix-blend-plus-lighter',
|
||||
'after:pointer-events-none',
|
||||
fit ? 'w-fit' : null,
|
||||
|
||||
@@ -5,6 +5,7 @@ import ReactDOM from 'react-dom';
|
||||
|
||||
import { Card } from '@/components/primitives';
|
||||
import { getEmbedByUrlInSpace, getEmbedByUrl } from '@/lib/api';
|
||||
import { getContentSecurityPolicyNonce } from '@/lib/csp';
|
||||
import { tcls } from '@/lib/tailwind';
|
||||
|
||||
import { BlockProps } from './Block';
|
||||
@@ -13,8 +14,7 @@ import { IntegrationBlock } from './Integration';
|
||||
|
||||
export async function Embed(props: BlockProps<gitbookAPI.DocumentBlockEmbed>) {
|
||||
const { block, context, ...otherProps } = props;
|
||||
const headersList = await headers();
|
||||
const nonce = headersList.get('x-nonce') || undefined;
|
||||
const nonce = await getContentSecurityPolicyNonce();
|
||||
|
||||
ReactDOM.preload('https://cdn.iframe.ly/embed.js', { as: 'script', nonce });
|
||||
|
||||
@@ -30,6 +30,7 @@ export async function Embed(props: BlockProps<gitbookAPI.DocumentBlockEmbed>) {
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: embed.html,
|
||||
}}
|
||||
data-visual-test="blackout"
|
||||
/>
|
||||
<Script src="https://cdn.iframe.ly/embed.js" nonce={nonce} />
|
||||
</>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DocumentBlockFile } from '@gitbook/api';
|
||||
import { DocumentBlockFile, SiteInsightsLinkPosition } from '@gitbook/api';
|
||||
|
||||
import { getSimplifiedContentType } from '@/lib/files';
|
||||
import { tcls } from '@/lib/tailwind';
|
||||
@@ -27,7 +27,7 @@ export async function File(props: BlockProps<DocumentBlockFile>) {
|
||||
download={file.name}
|
||||
insights={{
|
||||
target: block.data.ref,
|
||||
position: 'content',
|
||||
position: SiteInsightsLinkPosition.Content,
|
||||
}}
|
||||
className={tcls(
|
||||
'group/file',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DocumentInlineLink } from '@gitbook/api';
|
||||
import { DocumentInlineLink, SiteInsightsLinkPosition } from '@gitbook/api';
|
||||
|
||||
import { InlineProps } from './Inline';
|
||||
import { Inlines } from './Inlines';
|
||||
@@ -28,7 +28,7 @@ export async function InlineLink(props: InlineProps<DocumentInlineLink>) {
|
||||
className="underline underline-offset-2 text-primary hover:text-primary-700 transition-colors"
|
||||
insights={{
|
||||
target: inline.data.ref,
|
||||
position: 'content',
|
||||
position: SiteInsightsLinkPosition.Content,
|
||||
}}
|
||||
>
|
||||
<Inlines
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DocumentInlineMention } from '@gitbook/api';
|
||||
import { DocumentInlineMention, SiteInsightsLinkPosition } from '@gitbook/api';
|
||||
|
||||
import { StyledLink } from '@/components/primitives';
|
||||
|
||||
@@ -20,7 +20,7 @@ export async function Mention(props: InlineProps<DocumentInlineMention>) {
|
||||
href={resolved.href}
|
||||
insights={{
|
||||
target: inline.data.ref,
|
||||
position: 'content',
|
||||
position: SiteInsightsLinkPosition.Content,
|
||||
}}
|
||||
>
|
||||
{resolved.text}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ContentRef, DocumentTableViewCards } from '@gitbook/api';
|
||||
import { ContentRef, DocumentTableViewCards, SiteInsightsLinkPosition } from '@gitbook/api';
|
||||
import React from 'react';
|
||||
|
||||
import { Link } from '@/components/primitives';
|
||||
@@ -164,7 +164,7 @@ export async function RecordCard(
|
||||
])}
|
||||
insights={{
|
||||
target: targetRef,
|
||||
position: 'content',
|
||||
position: SiteInsightsLinkPosition.Content,
|
||||
}}
|
||||
>
|
||||
{body}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { ContentRef, ContentRefUser, DocumentBlockTable } from '@gitbook/api';
|
||||
import {
|
||||
ContentRef,
|
||||
ContentRefUser,
|
||||
DocumentBlockTable,
|
||||
SiteInsightsLinkPosition,
|
||||
} from '@gitbook/api';
|
||||
import { Icon } from '@gitbook/icons';
|
||||
import assertNever from 'assert-never';
|
||||
|
||||
@@ -11,7 +16,7 @@ import { tcls } from '@/lib/tailwind';
|
||||
import { filterOutNullable } from '@/lib/typescript';
|
||||
|
||||
import { TableRecordKV } from './Table';
|
||||
import { getColumnAlignment } from './utils';
|
||||
import { getColumnAlignment, VerticalAlignment } from './utils';
|
||||
import { BlockProps } from '../Block';
|
||||
import { Blocks } from '../Blocks';
|
||||
import { FileIcon } from '../FileIcon';
|
||||
@@ -25,9 +30,19 @@ export async function RecordColumnValue<Tag extends React.ElementType = 'div'>(
|
||||
ariaLabelledBy?: string;
|
||||
record: TableRecordKV;
|
||||
column: string;
|
||||
verticalAlignment?: VerticalAlignment;
|
||||
},
|
||||
) {
|
||||
const { tag: Tag = 'div', ariaLabelledBy, block, document, record, column, context } = props;
|
||||
const {
|
||||
tag: Tag = 'div',
|
||||
ariaLabelledBy,
|
||||
block,
|
||||
document,
|
||||
record,
|
||||
column,
|
||||
context,
|
||||
verticalAlignment = 'center',
|
||||
} = props;
|
||||
|
||||
const definition = block.data.definition[column];
|
||||
const value = record[1].values[column];
|
||||
@@ -99,7 +114,7 @@ export async function RecordColumnValue<Tag extends React.ElementType = 'div'>(
|
||||
// @ts-ignore
|
||||
const fragment = getNodeFragmentByName(block, value);
|
||||
if (!fragment) {
|
||||
return <Tag className={tcls(['w-full'])}>{''}</Tag>;
|
||||
return <Tag className={tcls(['w-full', verticalAlignment])}>{''}</Tag>;
|
||||
}
|
||||
|
||||
const alignment = getColumnAlignment(definition);
|
||||
@@ -115,6 +130,7 @@ export async function RecordColumnValue<Tag extends React.ElementType = 'div'>(
|
||||
'space-y-2',
|
||||
'lg:space-y-3',
|
||||
'leading-normal',
|
||||
verticalAlignment,
|
||||
alignment === 'right' ? 'text-right' : null,
|
||||
alignment === 'center' ? 'text-center' : null,
|
||||
]}
|
||||
@@ -155,7 +171,7 @@ export async function RecordColumnValue<Tag extends React.ElementType = 'div'>(
|
||||
kind: 'file',
|
||||
file: ref.file.id,
|
||||
},
|
||||
position: 'content',
|
||||
position: SiteInsightsLinkPosition.Content,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
@@ -209,7 +225,7 @@ export async function RecordColumnValue<Tag extends React.ElementType = 'div'>(
|
||||
contentRef
|
||||
? {
|
||||
target: contentRef,
|
||||
position: 'content',
|
||||
position: SiteInsightsLinkPosition.Content,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
@@ -244,7 +260,7 @@ export async function RecordColumnValue<Tag extends React.ElementType = 'div'>(
|
||||
href={resolved.href}
|
||||
insights={{
|
||||
target: contentRef,
|
||||
position: 'content',
|
||||
position: SiteInsightsLinkPosition.Content,
|
||||
}}
|
||||
>
|
||||
{resolved.text}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { DocumentTableViewGrid } from '@gitbook/api';
|
||||
import React from 'react';
|
||||
|
||||
import { tcls } from '@/lib/tailwind';
|
||||
|
||||
import { RecordColumnValue } from './RecordColumnValue';
|
||||
import { TableRecordKV, TableViewProps } from './Table';
|
||||
import styles from './table.module.css';
|
||||
import { getColumnVerticalAlignment } from './utils';
|
||||
import { getColumnWidth } from './ViewGrid';
|
||||
|
||||
export function RecordRow(
|
||||
@@ -13,7 +16,7 @@ export function RecordRow(
|
||||
fixedColumns: string[];
|
||||
},
|
||||
) {
|
||||
const { view, autoSizedColumns, fixedColumns } = props;
|
||||
const { view, autoSizedColumns, fixedColumns, block } = props;
|
||||
|
||||
return (
|
||||
<div className={styles.row} role="row">
|
||||
@@ -24,17 +27,23 @@ export function RecordRow(
|
||||
autoSizedColumns,
|
||||
fixedColumns,
|
||||
});
|
||||
const verticalAlignment = getColumnVerticalAlignment(block.data.definition[column]);
|
||||
|
||||
return (
|
||||
<div
|
||||
key={column}
|
||||
role="cell"
|
||||
className={styles.cell}
|
||||
className={tcls(styles.cell)}
|
||||
style={{
|
||||
width: columnWidth,
|
||||
minWidth: columnWidth || '100px',
|
||||
}}
|
||||
>
|
||||
<RecordColumnValue {...props} column={column} />
|
||||
<RecordColumnValue
|
||||
{...props}
|
||||
column={column}
|
||||
verticalAlignment={verticalAlignment}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
|
||||
.cell {
|
||||
@apply flex-1 align-middle border-tint-700/2 py-2 px-4 text-sm relative;
|
||||
@apply flex-1 flex align-middle border-tint-700/2 py-2 px-3 h-full text-sm relative;
|
||||
}
|
||||
|
||||
.cell:not(:last-child) {
|
||||
|
||||
@@ -20,3 +20,21 @@ export function getColumnAlignment(column: DocumentTableDefinition): 'left' | 'r
|
||||
}
|
||||
return 'left';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the vertical alignment for a column.
|
||||
*/
|
||||
export type VerticalAlignment = 'self-center' | 'self-end' | 'self-start';
|
||||
export function getColumnVerticalAlignment(column: DocumentTableDefinition): VerticalAlignment {
|
||||
const verticalAlignment = 'verticalAlignment' in column ? column.verticalAlignment : 'center';
|
||||
|
||||
if (verticalAlignment === 'top') {
|
||||
return 'self-start';
|
||||
}
|
||||
|
||||
if (verticalAlignment === 'bottom') {
|
||||
return 'self-end';
|
||||
}
|
||||
|
||||
return 'self-center';
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export function getBlockTextStyle(block: DocumentBlock): {
|
||||
};
|
||||
case 'heading-3':
|
||||
return {
|
||||
textSize: 'text-base font-semibold',
|
||||
textSize: 'text-xl font-semibold',
|
||||
lineHeight: 'leading-snug',
|
||||
marginTop: 'mt-[0.5em]',
|
||||
};
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { CustomizationContentLink, CustomizationFooterGroup } from '@gitbook/api';
|
||||
import {
|
||||
CustomizationContentLink,
|
||||
CustomizationFooterGroup,
|
||||
SiteInsightsLinkPosition,
|
||||
} from '@gitbook/api';
|
||||
|
||||
import { ContentRefContext, resolveContentRef } from '@/lib/references';
|
||||
import { tcls } from '@/lib/tailwind';
|
||||
@@ -42,7 +46,7 @@ async function FooterLink(props: { link: CustomizationContentLink; context: Cont
|
||||
)}
|
||||
insights={{
|
||||
target: link.to,
|
||||
position: 'footer',
|
||||
position: SiteInsightsLinkPosition.Footer,
|
||||
}}
|
||||
>
|
||||
{link.title}
|
||||
|
||||
@@ -91,8 +91,9 @@ export function DropdownChevron() {
|
||||
'opacity-6',
|
||||
'size-3',
|
||||
'ms-1',
|
||||
'transition-transform',
|
||||
'group-hover/dropdown:rotate-180',
|
||||
'transition-all',
|
||||
'group-hover/dropdown:opacity-11',
|
||||
'group-focus-within/dropdown:rotate-180',
|
||||
)}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -14,8 +14,9 @@ import { HeaderLinks } from './HeaderLinks';
|
||||
import { HeaderLogo } from './HeaderLogo';
|
||||
import { SpacesDropdown } from './SpacesDropdown';
|
||||
import { SearchButton } from '../Search';
|
||||
import { SiteSectionTabs } from '../SiteSectionTabs';
|
||||
import { SiteSectionTabs } from '../SiteSections';
|
||||
import { HeaderMobileMenu } from './HeaderMobileMenu';
|
||||
|
||||
/**
|
||||
* Render the header for the space.
|
||||
*/
|
||||
@@ -74,14 +75,23 @@ export function Header(props: {
|
||||
'gap-4',
|
||||
'lg:gap-8',
|
||||
'flex',
|
||||
'h-16',
|
||||
'items-center',
|
||||
'justify-between',
|
||||
'w-full',
|
||||
'py-3',
|
||||
'min-h-16',
|
||||
'sm:h-16',
|
||||
isMultiVariants && 'page-no-toc:max-[400px]:flex-wrap',
|
||||
CONTAINER_STYLE,
|
||||
)}
|
||||
>
|
||||
<div className="flex max-w-full shrink min-w-0 gap-2 lg:gap-4 justify-start items-center">
|
||||
<div
|
||||
className={tcls(
|
||||
'flex max-w-full',
|
||||
isMultiVariants && 'page-no-toc:max-[400px]:w-full',
|
||||
'shrink min-w-0 gap-2 lg:gap-4 justify-start items-center',
|
||||
)}
|
||||
>
|
||||
<HeaderMobileMenu
|
||||
className={tcls(
|
||||
'lg:hidden',
|
||||
@@ -93,31 +103,33 @@ export function Header(props: {
|
||||
)}
|
||||
/>
|
||||
<HeaderLogo site={site} space={space} customization={customization} />
|
||||
{!hasSiteSections && isMultiVariants ? (
|
||||
<div className="z-20 shrink hidden sm:block">
|
||||
<SpacesDropdown
|
||||
className={tcls(
|
||||
!isCustomizationDefault &&
|
||||
withTopHeader && [
|
||||
'bg-header-link/2',
|
||||
'dark:bg-header-link/2',
|
||||
'text-header-link/8',
|
||||
'dark:text-header-link/8',
|
||||
'ring-1',
|
||||
'ring-header-link/4',
|
||||
'dark:ring-header-link/4',
|
||||
'contrast-more:bg-header-background',
|
||||
'contrast-more:text-header-link',
|
||||
'contrast-more:ring-header-link',
|
||||
],
|
||||
)}
|
||||
space={space}
|
||||
spaces={spaces}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{isMultiVariants && (
|
||||
<div className="hidden page-no-toc:flex mr-auto">
|
||||
<SpacesDropdown
|
||||
space={space}
|
||||
spaces={spaces}
|
||||
className={
|
||||
!isCustomizationDefault
|
||||
? `bg-header-link/2 text-header-link ring-header-link/4
|
||||
dark:bg-header-link/2 dark:text-header-link dark:ring-header-link/4
|
||||
group-hover/dropdown:bg-header-link/3 group-hover/dropdown:text-header-link group-hover/dropdown:ring-header-link/6
|
||||
dark:group-hover/dropdown:bg-header-link/3 dark:group-hover/dropdown:text-header-link dark:group-hover/dropdown:ring-header-link/6
|
||||
group-focus-within/dropdown:bg-header-link/3 group-focus-within/dropdown:text-header-link group-focus-within/dropdown:ring-header-link/6
|
||||
dark:group-focus-within/dropdown:bg-header-link/3 dark:group-focus-within/dropdown:text-header-link dark:group-focus-within/dropdown:ring-header-link/6
|
||||
|
||||
contrast-more:bg-header-background contrast-more:text-header-link contrast-more:ring-header-link
|
||||
contrast-more:group-hover/dropdown:text-header-link contrast-more:group-hover/dropdown:ring-header-link
|
||||
contrast-more:dark:group-hover/dropdown:text-header-link contrast-more:dark:group-hover/dropdown:ring-header-link
|
||||
contrast-more:group-focus-within/dropdown:text-header-link contrast-more:group-focus-within/dropdown:ring-header-link
|
||||
contrast-more:dark:group-focus-within/dropdown:text-header-link contrast-more:dark:group-focus-within/dropdown:ring-header-link`
|
||||
: ''
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{customization.header.links.length > 0 && (
|
||||
<HeaderLinks>
|
||||
{customization.header.links.map((link, index) => {
|
||||
@@ -218,7 +230,7 @@ export function Header(props: {
|
||||
'overflow-x-auto hide-scroll',
|
||||
)}
|
||||
>
|
||||
<SiteSectionTabs {...sections} />
|
||||
<SiteSectionTabs sections={sections} />
|
||||
</div>
|
||||
) : null}
|
||||
</header>
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
SiteCustomizationSettings,
|
||||
CustomizationHeaderItem,
|
||||
ContentRef,
|
||||
SiteInsightsLinkPosition,
|
||||
} from '@gitbook/api';
|
||||
import assertNever from 'assert-never';
|
||||
|
||||
@@ -129,24 +130,23 @@ function HeaderItemButton(
|
||||
className={tcls(
|
||||
{
|
||||
'button-primary':
|
||||
headerPreset === CustomizationHeaderPreset.Custom ||
|
||||
headerPreset === CustomizationHeaderPreset.Bold
|
||||
? tcls(
|
||||
'bg-header-link-500 hover:bg-text-header-link-300 text-header-button-text',
|
||||
'dark:bg-header-link-500 dark:hover:bg-text-header-link-300 dark:text-header-button-text',
|
||||
)
|
||||
: null,
|
||||
headerPreset != CustomizationHeaderPreset.Default &&
|
||||
`bg-header-link dark:bg-header-link hover:bg-header-link dark:hover:bg-header-link
|
||||
text-header-background dark:text-header-background hover:text-header-background dark:hover:text-header-background
|
||||
shadow-none hover:shadow-none`,
|
||||
'button-secondary': tcls(
|
||||
'bg:transparent hover:bg-transparent',
|
||||
'dark:bg-transparent dark:hover:bg-transparent',
|
||||
'ring-header-link-500 hover:ring-header-link-300 text-header-link-500',
|
||||
'dark:ring-header-link-500 dark:hover:ring-header-link-300 dark:text-header-link-500',
|
||||
headerPreset != CustomizationHeaderPreset.Default &&
|
||||
`bg-header-link/2 dark:bg-header-link/2 hover:bg-header-link/3 dark:hover:bg-header-link/3
|
||||
text-header-link dark:text-header-link hover:text-header-link dark:hover:text-header-link
|
||||
ring-header-link/4 dark:ring-header-link/4 hover:ring-header-link/5 dark:hover:ring-header-link/5
|
||||
contrast-more:ring-header-link contrast-more:bg-header-background contrast-more:text-header-link contrast-more:hover:ring-header-link
|
||||
shadow-none hover:shadow-none`,
|
||||
),
|
||||
}[linkStyle],
|
||||
)}
|
||||
insights={{
|
||||
target: linkTarget,
|
||||
position: 'header',
|
||||
position: SiteInsightsLinkPosition.Header,
|
||||
}}
|
||||
{...rest}
|
||||
>
|
||||
@@ -160,6 +160,7 @@ function getHeaderLinkClassName(props: { headerPreset: CustomizationHeaderPreset
|
||||
'flex items-center shrink',
|
||||
'hover:text-header-link-400 dark:hover:text-light',
|
||||
'min-w-0',
|
||||
'contrast-more:underline',
|
||||
|
||||
props.headerPreset === CustomizationHeaderPreset.Default
|
||||
? ['text-dark/8', 'dark:text-light/8']
|
||||
@@ -175,7 +176,7 @@ function HeaderItemLink(props: Omit<HeaderLinkNavItemProps, 'linkStyle'>) {
|
||||
className={getHeaderLinkClassName({ headerPreset })}
|
||||
insights={{
|
||||
target: linkTarget,
|
||||
position: 'header',
|
||||
position: SiteInsightsLinkPosition.Header,
|
||||
}}
|
||||
{...rest}
|
||||
>
|
||||
@@ -216,7 +217,10 @@ async function SubHeaderLink(props: {
|
||||
}
|
||||
|
||||
return (
|
||||
<DropdownMenuItem href={target.href} insights={{ target: link.to, position: 'header' }}>
|
||||
<DropdownMenuItem
|
||||
href={target.href}
|
||||
insights={{ target: link.to, position: SiteInsightsLinkPosition.Header }}
|
||||
>
|
||||
{link.title}
|
||||
</DropdownMenuItem>
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
CustomizationHeaderPreset,
|
||||
CustomizationSettings,
|
||||
SiteCustomizationSettings,
|
||||
SiteInsightsLinkPosition,
|
||||
} from '@gitbook/api';
|
||||
import { Icon } from '@gitbook/icons';
|
||||
import React from 'react';
|
||||
@@ -82,7 +83,7 @@ async function MoreMenuLink(props: {
|
||||
link.to
|
||||
? {
|
||||
target: link.to,
|
||||
position: 'header',
|
||||
position: SiteInsightsLinkPosition.Header,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function HeaderLinks({ children }: HeaderLinksProps) {
|
||||
<div
|
||||
className={tcls(
|
||||
styles.containerHeaderlinks,
|
||||
'grow shrink flex justify-end items-center gap-x-6 lg:gap-x-8 min-w-9 z-20',
|
||||
'grow shrink flex justify-end items-center gap-x-4 lg:gap-x-6 min-w-9 z-20',
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -11,18 +11,19 @@ import { useScrollListener } from '../hooks/useScrollListener';
|
||||
|
||||
const globalClassName = 'navigation-open';
|
||||
|
||||
const SCROLL_DISTANCE = 320;
|
||||
|
||||
/**
|
||||
* Button to show/hide the table of content on mobile.
|
||||
*/
|
||||
export function HeaderMobileMenu(props: Partial<React.ButtonHTMLAttributes<HTMLButtonElement>>) {
|
||||
const language = useLanguage();
|
||||
const scrollDistance = 320;
|
||||
|
||||
const pathname = usePathname();
|
||||
const [hasScrolled, setHasScrolled] = useState(false);
|
||||
const hasScrollRef = useRef(false);
|
||||
|
||||
const toggleNavigation = () => {
|
||||
if (!hasScrolled && document.body.classList.contains(globalClassName)) {
|
||||
if (!hasScrollRef.current && document.body.classList.contains(globalClassName)) {
|
||||
document.body.classList.remove(globalClassName);
|
||||
} else {
|
||||
document.body.classList.add(globalClassName);
|
||||
@@ -32,11 +33,7 @@ export function HeaderMobileMenu(props: Partial<React.ButtonHTMLAttributes<HTMLB
|
||||
|
||||
const windowRef = useRef(typeof window === 'undefined' ? null : window);
|
||||
useScrollListener(() => {
|
||||
if (window.scrollY >= scrollDistance) {
|
||||
setHasScrolled(true);
|
||||
} else {
|
||||
setHasScrolled(false);
|
||||
}
|
||||
hasScrollRef.current = window.scrollY >= SCROLL_DISTANCE;
|
||||
}, windowRef);
|
||||
|
||||
// Close the navigation when navigating to a page
|
||||
|
||||
@@ -10,6 +10,10 @@ export function SpacesDropdown(props: { space: Space; spaces: Space[]; className
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
className={tcls(
|
||||
'group-hover/dropdown:invisible', // Prevent hover from opening the dropdown, as it's annoying in this context
|
||||
'group-focus-within/dropdown:group-hover/dropdown:visible', // When the dropdown is already open, it should remain visible when hovered
|
||||
)}
|
||||
button={(buttonProps) => (
|
||||
<div
|
||||
{...buttonProps}
|
||||
@@ -18,29 +22,54 @@ export function SpacesDropdown(props: { space: Space; spaces: Space[]; className
|
||||
'flex',
|
||||
'flex-row',
|
||||
'items-center',
|
||||
'rounded-2xl',
|
||||
'transition-all',
|
||||
'hover:cursor-pointer',
|
||||
|
||||
'px-3',
|
||||
'py-2',
|
||||
'gap-2',
|
||||
|
||||
'rounded-md',
|
||||
'straight-corners:rounded-none',
|
||||
|
||||
'hover:cursor-pointer',
|
||||
'bg-dark/1',
|
||||
'dark:bg-light/1',
|
||||
'bg-light',
|
||||
'group-hover/dropdown:bg-light-1',
|
||||
'group-focus-within/dropdown:bg-light-1',
|
||||
'dark:bg-dark-1',
|
||||
'dark:group-hover/dropdown:bg-dark-3',
|
||||
'dark:group-focus-within/dropdown:bg-dark-3',
|
||||
|
||||
'text-sm',
|
||||
'text-dark-4',
|
||||
'group-hover/dropdown:text-dark',
|
||||
'group-focus-within/dropdown:text-dark',
|
||||
'dark:text-light-4',
|
||||
'dark:group-hover/dropdown:text-light',
|
||||
'dark:group-focus-within/dropdown:text-light',
|
||||
|
||||
'ring-1',
|
||||
'ring-dark/2',
|
||||
'group-hover/dropdown:ring-dark/4',
|
||||
'group-focus-within/dropdown:ring-dark/4',
|
||||
'dark:ring-light/2',
|
||||
'dark:group-hover/dropdown:ring-light/4',
|
||||
'dark:group-focus-within/dropdown:ring-light/4',
|
||||
|
||||
'contrast-more:bg-light',
|
||||
'contrast-more:ring-1',
|
||||
'contrast-more:ring-dark',
|
||||
'dark:contrast-more:ring-light',
|
||||
'dark:contrast-more:bg-dark',
|
||||
'contrast-more:ring-1',
|
||||
'contrast-more:group-hover/dropdown:ring-2',
|
||||
'contrast-more:ring-dark',
|
||||
'contrast-more:group-hover/dropdown:ring-dark',
|
||||
'contrast-more:group-focus-within/dropdown:ring-dark',
|
||||
'dark:contrast-more:ring-light',
|
||||
'dark:contrast-more:group-hover/dropdown:ring-light',
|
||||
'dark:contrast-more:group-focus-within/dropdown:ring-light',
|
||||
|
||||
'px-3',
|
||||
'py-1',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<span className="line-clamp-2">{space.title}</span>
|
||||
<span className={tcls('line-clamp-2', 'grow')}>{space.title}</span>
|
||||
<DropdownChevron />
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import cookies from 'js-cookie';
|
||||
import * as cookies from '@/lib/cookies';
|
||||
|
||||
import { isCookiesTrackingDisabled } from './cookies';
|
||||
import { generateRandomId } from './utils';
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { Transition, motion, useReducedMotion } from 'framer-motion';
|
||||
import React from 'react';
|
||||
|
||||
import { tcls } from '@/lib/tailwind';
|
||||
|
||||
export function AnimatedLine({ transition }: { transition?: Transition }) {
|
||||
const prefersReducedMotion = useReducedMotion();
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
layout
|
||||
layoutId="sections-line"
|
||||
className={tcls([
|
||||
'border-primary',
|
||||
'border-l',
|
||||
'dark:border-primary-400',
|
||||
'h-full',
|
||||
'absolute',
|
||||
'z-20',
|
||||
'-left-[5px]',
|
||||
])}
|
||||
transition={prefersReducedMotion ? { duration: 0 } : transition}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
'use client';
|
||||
|
||||
import { Transition, motion, useReducedMotion } from 'framer-motion';
|
||||
import React from 'react';
|
||||
|
||||
import { ClassValue, tcls } from '@/lib/tailwind';
|
||||
|
||||
export function AsideSectionHighlight({
|
||||
transition,
|
||||
className,
|
||||
}: {
|
||||
transition?: Transition;
|
||||
className?: ClassValue;
|
||||
}) {
|
||||
const prefersReducedMotion = useReducedMotion();
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
layout
|
||||
layoutId="sections-line"
|
||||
className={tcls([
|
||||
'border-tint',
|
||||
'sidebar-list-line:border-l-2',
|
||||
|
||||
'dark:border-tint-400',
|
||||
'inset-0',
|
||||
'pointer-events-none',
|
||||
'absolute',
|
||||
'z-0',
|
||||
'sidebar-list-line:-left-px',
|
||||
|
||||
'rounded-md',
|
||||
'straight-corners:rounded-none',
|
||||
'sidebar-list-line:rounded-l-none',
|
||||
|
||||
'sidebar-list-pill:bg-tint/3',
|
||||
'dark:sidebar-list-pill:bg-tint-400/3',
|
||||
|
||||
'contrast-more:border',
|
||||
'contrast-more:bg-tint/3',
|
||||
'dark:contrast-more:bg-tint-400/3',
|
||||
className,
|
||||
])}
|
||||
transition={prefersReducedMotion ? { duration: 0 } : transition}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -23,13 +23,15 @@ import { Ad } from '../Ads';
|
||||
import { PageFeedbackForm } from '../PageFeedback';
|
||||
|
||||
function getTopOffset(props: { sectionsHeader: boolean; topHeader: boolean }) {
|
||||
if (props.sectionsHeader && props.topHeader) {
|
||||
return 'lg:max-h-[calc(100vh_-_8rem)] top-32 page-api-block:xl:max-2xl:top-32';
|
||||
if (props.topHeader && props.sectionsHeader) {
|
||||
return 'lg:top-[6.75rem] lg:max-h-[calc(100vh_-_6.75rem)]';
|
||||
}
|
||||
|
||||
if (props.topHeader) {
|
||||
return 'lg:max-h-[calc(100vh_-_6rem)] top-24 page-api-block:xl:max-2xl:top-24';
|
||||
return 'lg:top-16 lg:max-h-[calc(100vh_-_4rem)]';
|
||||
}
|
||||
return 'lg:max-h-screen top-0 page-api-block:xl:max-2xl:top-0';
|
||||
|
||||
return 'lg:top-0 lg:max-h-screen';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,22 +78,32 @@ export async function PageAside(props: {
|
||||
'grow-0',
|
||||
'shrink-0',
|
||||
'sticky',
|
||||
withHeaderOffset.topHeader ? 'py-4' : 'py-8',
|
||||
'break-anywhere', // To prevent long words in headings from breaking the layout
|
||||
'lg:h-full',
|
||||
'h-[100vh]',
|
||||
'page-api-block:xl:max-2xl:z-[1]',
|
||||
|
||||
'text-dark/7',
|
||||
'dark:text-light/7',
|
||||
'contrast-more:text-dark',
|
||||
'contrast-more:dark:text-light',
|
||||
|
||||
// When in api page mode, we display it as an overlay on non-large resolutions
|
||||
'page-api-block:xl:max-2xl:backdrop-blur-md',
|
||||
'page-api-block:xl:max-2xl:z-10',
|
||||
'page-api-block:xl:max-2xl:fixed',
|
||||
'page-api-block:xl:max-2xl:right-8',
|
||||
'page-api-block:xl:max-2xl:w-56',
|
||||
'page-api-block:xl:max-2xl:bg-light-2/9',
|
||||
'page-api-block:xl:max-2xl:rounded',
|
||||
'page-api-block:xl:max-2xl:bg-light-2',
|
||||
'page-api-block:xl:max-2xl:bg-opacity-9',
|
||||
'page-api-block:xl:max-2xl:contrast-more:bg-opacity-11',
|
||||
'page-api-block:xl:max-2xl:backdrop-blur-lg',
|
||||
'page-api-block:xl:max-2xl:border',
|
||||
'page-api-block:xl:max-2xl:border-dark/2',
|
||||
'page-api-block:xl:max-2xl:dark:border-light/2',
|
||||
'page-api-block:xl:max-2xl:hover:shadow-lg',
|
||||
'page-api-block:xl:max-2xl:hover:shadow-dark/2',
|
||||
'page-api-block:xl:max-2xl:rounded-md',
|
||||
'page-api-block:xl:max-2xl:h-auto',
|
||||
'page-api-block:xl:max-2xl:py-0',
|
||||
'page-api-block:xl:max-2xl:mt-3',
|
||||
'page-api-block:xl:max-2xl:my-8',
|
||||
'dark:page-api-block:xl:max-2xl:bg-dark-2/8',
|
||||
|
||||
topOffset,
|
||||
)}
|
||||
>
|
||||
@@ -99,17 +111,28 @@ export async function PageAside(props: {
|
||||
className={tcls(
|
||||
'hidden',
|
||||
'page-api-block:xl:max-2xl:flex',
|
||||
'text-xs',
|
||||
'tracking-wide',
|
||||
'font-semibold',
|
||||
'uppercase',
|
||||
|
||||
'flex-row',
|
||||
'items-center',
|
||||
'gap-3',
|
||||
'text-sm',
|
||||
'font-semibold',
|
||||
'px-2',
|
||||
'py-2',
|
||||
'gap-2',
|
||||
'p-2',
|
||||
)}
|
||||
>
|
||||
<Icon icon="bars" className={tcls('size-3')} />
|
||||
<Icon icon="block-quote" className={tcls('size-3')} />
|
||||
{t(language, 'on_this_page')}
|
||||
<Icon
|
||||
icon="chevron-down"
|
||||
className={tcls(
|
||||
'size-3',
|
||||
'opacity-6',
|
||||
'ml-auto',
|
||||
'page-api-block:xl:max-2xl:group-hover/aside:hidden',
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className={tcls(
|
||||
@@ -118,9 +141,11 @@ export async function PageAside(props: {
|
||||
'flex',
|
||||
'flex-col',
|
||||
'gap-6',
|
||||
'py-8',
|
||||
'[&::-webkit-scrollbar]:bg-transparent',
|
||||
'[&::-webkit-scrollbar-thumb]:bg-transparent',
|
||||
|
||||
'page-api-block:xl:max-2xl:py-0',
|
||||
// Hide it for api page, until hovered
|
||||
'page-api-block:xl:max-2xl:hidden',
|
||||
'page-api-block:xl:max-2xl:group-hover/aside:flex',
|
||||
@@ -132,7 +157,20 @@ export async function PageAside(props: {
|
||||
</React.Suspense>
|
||||
) : null}
|
||||
<div
|
||||
className={tcls('flex', 'flex-col', 'gap-3', 'page-api-block:xl:max-2xl:px-3')}
|
||||
className={tcls(
|
||||
'flex',
|
||||
'flex-col',
|
||||
'gap-3',
|
||||
'sidebar-list-default:px-3',
|
||||
'border-t',
|
||||
'first:border-none',
|
||||
'border-dark/2',
|
||||
'dark:border-light/2',
|
||||
'py-4',
|
||||
'first:pt-0',
|
||||
'page-api-block:xl:max-2xl:px-3',
|
||||
'empty:hidden',
|
||||
)}
|
||||
>
|
||||
{withPageFeedback ? (
|
||||
<React.Suspense fallback={null}>
|
||||
@@ -148,10 +186,8 @@ export async function PageAside(props: {
|
||||
'flex-row',
|
||||
'items-center',
|
||||
'text-sm',
|
||||
'text-dark/6',
|
||||
'hover:text-primary',
|
||||
'py-2',
|
||||
'dark:text-light/5',
|
||||
)}
|
||||
>
|
||||
<Icon
|
||||
@@ -175,10 +211,8 @@ export async function PageAside(props: {
|
||||
'flex-row',
|
||||
'items-center',
|
||||
'text-sm',
|
||||
'text-dark/6',
|
||||
'hover:text-primary',
|
||||
'py-2',
|
||||
'dark:text-light/5',
|
||||
)}
|
||||
>
|
||||
<Icon icon="file-pdf" className={tcls('size-4', 'mr-1.5')} />
|
||||
@@ -196,7 +230,7 @@ export async function PageAside(props: {
|
||||
spaceId={space.id}
|
||||
siteAdsStatus={site?.ads && site.ads.status ? site.ads.status : undefined}
|
||||
ignore={process.env.NODE_ENV !== 'production'}
|
||||
style={tcls('mt-4')}
|
||||
style={tcls(site?.ads && site.ads.status === SiteAdsStatus.Live && ['mb-4'])}
|
||||
/>
|
||||
</aside>
|
||||
);
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useScrollActiveId } from '@/components/hooks';
|
||||
import { DocumentSection } from '@/lib/document';
|
||||
import { tcls } from '@/lib/tailwind';
|
||||
|
||||
import { AnimatedLine } from './AnimatedLine';
|
||||
import { AsideSectionHighlight } from './AsideSectionHighlight';
|
||||
import { HEADER_HEIGHT_DESKTOP } from '../layout';
|
||||
|
||||
/**
|
||||
@@ -36,44 +36,88 @@ export function ScrollSectionsList(props: { sections: DocumentSection[] }) {
|
||||
});
|
||||
|
||||
return (
|
||||
<ul className={tcls('border-l', 'border-dark/2', 'dark:border-light/1', 'pl-1')}>
|
||||
<ul className={tcls('sidebar-list-line:border-l', 'border-dark/2', 'dark:border-light/1')}>
|
||||
{sections.map((section) => (
|
||||
<motion.li
|
||||
key={section.id}
|
||||
className={tcls('flex', 'flex-row', 'relative', 'h-fit')}
|
||||
className={tcls(
|
||||
'flex',
|
||||
'flex-row',
|
||||
'relative',
|
||||
'h-fit',
|
||||
'mt-2',
|
||||
section.depth > 1 && ['ml-3', 'my-0', 'sidebar-list-line:ml-0'],
|
||||
)}
|
||||
>
|
||||
{activeId === section.id ? <AnimatedLine transition={springCurve} /> : null}
|
||||
{activeId === section.id ? (
|
||||
<AsideSectionHighlight
|
||||
transition={springCurve}
|
||||
className={tcls(
|
||||
section?.depth > 1
|
||||
? [
|
||||
'sidebar-list-default:rounded-l-none',
|
||||
'sidebar-list-line:rounded-l-none',
|
||||
'sidebar-list-default:border-l',
|
||||
]
|
||||
: [
|
||||
'sidebar-list-default:ml-3',
|
||||
'contrast-more:sidebar-list-default:ml-0',
|
||||
],
|
||||
)}
|
||||
/>
|
||||
) : null}
|
||||
<a
|
||||
href={`#${section.id}`}
|
||||
className={tcls(
|
||||
'relative',
|
||||
'flex',
|
||||
'flex-row',
|
||||
'z-10',
|
||||
'w-full',
|
||||
'items-baseline',
|
||||
'left-[-1px]',
|
||||
'relative',
|
||||
'z-10',
|
||||
'text-sm',
|
||||
|
||||
'w-full',
|
||||
'py-1',
|
||||
'ps-3',
|
||||
'pe-2',
|
||||
'px-3',
|
||||
|
||||
'transition-all',
|
||||
'duration-200',
|
||||
section.depth > 1 ? ['ps-6', 'opacity-8'] : null,
|
||||
activeId === section.id
|
||||
? [
|
||||
'text-primary',
|
||||
'dark:text-primary-400',
|
||||
'[&>span]:bg-primary-400',
|
||||
'dark:[&>span]:bg-primary-600',
|
||||
'dark:[&>span]:text-dark',
|
||||
]
|
||||
: [
|
||||
'text-neutral-500',
|
||||
'dark:text-neutral-400',
|
||||
'hover:text-neutral-900',
|
||||
'dark:hover:text-neutral-100',
|
||||
],
|
||||
|
||||
'rounded-md',
|
||||
'straight-corners:rounded-none',
|
||||
'sidebar-list-line:rounded-l-none',
|
||||
|
||||
'hover:bg-dark/1',
|
||||
'dark:hover:bg-light/1',
|
||||
'contrast-more:hover:ring-1',
|
||||
'contrast-more:hover:ring-inset',
|
||||
'contrast-more:hover:ring-current',
|
||||
|
||||
section.depth > 1 && [
|
||||
'subitem',
|
||||
'sidebar-list-line:pl-6',
|
||||
'opacity-8',
|
||||
'contrast-more:opacity-11',
|
||||
|
||||
'sidebar-list-default:rounded-l-none',
|
||||
'sidebar-list-default:border-l',
|
||||
'sidebar-list-default:border-dark/3',
|
||||
'dark:sidebar-list-default:border-light/3',
|
||||
],
|
||||
|
||||
activeId === section.id && [
|
||||
'text-tint',
|
||||
'hover:text-tint',
|
||||
'dark:text-tint-400',
|
||||
'dark:hover:text-tint-400',
|
||||
|
||||
'contrast-more:font-semibold',
|
||||
|
||||
'hover:bg-tint/3',
|
||||
'dark:hover:bg-tint-400/3',
|
||||
'sidebar-list-pill:hover:bg-transparent',
|
||||
'dark:sidebar-list-pill:hover:bg-transparent',
|
||||
],
|
||||
)}
|
||||
>
|
||||
{section.tag ? (
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { RevisionPage, RevisionPageDocument, RevisionPageType } from '@gitbook/api';
|
||||
import {
|
||||
RevisionPage,
|
||||
RevisionPageDocument,
|
||||
RevisionPageType,
|
||||
SiteInsightsLinkPosition,
|
||||
} from '@gitbook/api';
|
||||
|
||||
import { Card } from '@/components/primitives';
|
||||
import { getPageHref } from '@/lib/links';
|
||||
@@ -48,7 +53,7 @@ export async function PageBodyBlankslate(props: {
|
||||
href={resolved.href}
|
||||
insights={{
|
||||
target: child.target,
|
||||
position: 'content',
|
||||
position: SiteInsightsLinkPosition.Content,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
Revision,
|
||||
RevisionPageDocument,
|
||||
SiteCustomizationSettings,
|
||||
SiteInsightsLinkPosition,
|
||||
Space,
|
||||
} from '@gitbook/api';
|
||||
import { Icon, IconName } from '@gitbook/icons';
|
||||
@@ -54,7 +55,7 @@ export async function PageFooterNavigation(props: {
|
||||
kind: 'page',
|
||||
page: previous.id,
|
||||
},
|
||||
position: 'content',
|
||||
position: SiteInsightsLinkPosition.Content,
|
||||
}}
|
||||
reversed
|
||||
/>
|
||||
@@ -70,7 +71,7 @@ export async function PageFooterNavigation(props: {
|
||||
kind: 'page',
|
||||
page: next.id,
|
||||
},
|
||||
position: 'content',
|
||||
position: SiteInsightsLinkPosition.Content,
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
@@ -37,12 +37,14 @@ export async function PageHeader(props: {
|
||||
'uppercase',
|
||||
'flex',
|
||||
'items-center',
|
||||
'gap-1',
|
||||
'gap-1.5',
|
||||
'contrast-more:underline',
|
||||
'contrast-more:decoration-current',
|
||||
)}
|
||||
>
|
||||
<PageIcon
|
||||
page={breadcrumb}
|
||||
style={tcls('size-4', 'text-base', 'leading-none')}
|
||||
style="size-4 flex items-center justify-center text-base leading-none"
|
||||
/>
|
||||
{breadcrumb.title}
|
||||
</StyledLink>
|
||||
|
||||
@@ -47,9 +47,7 @@ export function PageFeedbackForm(props: {
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<p className={tcls('text-sm', 'text-dark/6', 'dark:text-light/5')}>
|
||||
{t(languages, 'was_this_helpful')}
|
||||
</p>
|
||||
<p className={tcls('text-sm')}>{t(languages, 'was_this_helpful')}</p>
|
||||
<div
|
||||
className={tcls(
|
||||
'inline-flex',
|
||||
@@ -66,7 +64,7 @@ export function PageFeedbackForm(props: {
|
||||
)}
|
||||
>
|
||||
{submitted ? (
|
||||
<p className={tcls('text-sm', 'px-4', 'text-dark/7', 'dark:text-light/6')}>
|
||||
<p className={tcls('text-sm', 'px-4')}>
|
||||
{t(languages, 'was_this_helpful_thank_you')}
|
||||
</p>
|
||||
) : (
|
||||
@@ -117,12 +115,12 @@ function RatingButton(props: { rating: number; label: string; onClick: () => voi
|
||||
'h-8',
|
||||
'w-8',
|
||||
'rounded-sm',
|
||||
'text-dark/6',
|
||||
'hover:bg-primary/4',
|
||||
'hover:text-primary-600',
|
||||
'dark:text-light/5',
|
||||
'dark:hover:text-primary-300',
|
||||
'dark:hover:bg-primary-300/2',
|
||||
'text-dark/7',
|
||||
'hover:bg-tint/4',
|
||||
'hover:text-tint-600',
|
||||
'dark:text-light/7',
|
||||
'dark:hover:text-tint-300',
|
||||
'dark:hover:bg-tint-300/2',
|
||||
)}
|
||||
aria-label={label}
|
||||
title={label}
|
||||
|
||||
@@ -87,7 +87,7 @@ export async function CustomizationRootLayout(props: {
|
||||
)
|
||||
}
|
||||
|
||||
${generateColorVariable('tint-color', tintColor?.light ?? DEFAULT_TINT_COLOR)}
|
||||
${generateColorVariable('tint-color', tintColor?.light ?? customization.styling.primaryColor.light ?? DEFAULT_TINT_COLOR)}
|
||||
${
|
||||
// Generate the right contrast color for each shade of tint-color
|
||||
generateColorVariable(
|
||||
@@ -130,7 +130,7 @@ export async function CustomizationRootLayout(props: {
|
||||
)
|
||||
}
|
||||
|
||||
${generateColorVariable('tint-color', tintColor?.dark ?? DEFAULT_TINT_COLOR)}
|
||||
${generateColorVariable('tint-color', tintColor?.dark ?? customization.styling.primaryColor.dark ?? DEFAULT_TINT_COLOR)}
|
||||
${
|
||||
// Generate the right contrast color for each shade of tint-color
|
||||
generateColorVariable(
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
@apply leading-relaxed;
|
||||
}
|
||||
body {
|
||||
@apply text-dark dark:text-light;
|
||||
@apply text-dark dark:text-light antialiased;
|
||||
}
|
||||
html {
|
||||
@apply gutter-stable;
|
||||
@@ -54,6 +54,12 @@
|
||||
@apply outline-2 outline-primary/6;
|
||||
}
|
||||
|
||||
code,
|
||||
pre {
|
||||
/* Don't apply antialiased to `code` and `pre` elements */
|
||||
@apply subpixel-antialiased;
|
||||
}
|
||||
|
||||
/* Light mode */
|
||||
::-webkit-scrollbar {
|
||||
@apply bg-dark/1;
|
||||
|
||||
@@ -141,7 +141,7 @@ function AnswerBody(props: { answer: AskAnswerResult }) {
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
data-test="search-ask-answer"
|
||||
data-testid="search-ask-answer"
|
||||
className={tcls(
|
||||
'my-4',
|
||||
'sm:mt-6',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user