diff --git a/.changeset/funky-actors-lie.md b/.changeset/funky-actors-lie.md
new file mode 100644
index 000000000..1f437a4f0
--- /dev/null
+++ b/.changeset/funky-actors-lie.md
@@ -0,0 +1,5 @@
+---
+"gitbook": patch
+---
+
+Align styling of PageLinkItem and PageDocumentItem
diff --git a/.changeset/grumpy-dogs-cough.md b/.changeset/grumpy-dogs-cough.md
new file mode 100644
index 000000000..8165924af
--- /dev/null
+++ b/.changeset/grumpy-dogs-cough.md
@@ -0,0 +1,5 @@
+---
+"gitbook": patch
+---
+
+Better conditional display of page actions
diff --git a/.changeset/rare-ties-find.md b/.changeset/rare-ties-find.md
new file mode 100644
index 000000000..3c7de54c2
--- /dev/null
+++ b/.changeset/rare-ties-find.md
@@ -0,0 +1,5 @@
+---
+"gitbook": patch
+---
+
+Standardise toggle chevrons across the app
diff --git a/packages/gitbook/e2e/internal.spec.ts b/packages/gitbook/e2e/internal.spec.ts
index e3e1aa076..ad403bae4 100644
--- a/packages/gitbook/e2e/internal.spec.ts
+++ b/packages/gitbook/e2e/internal.spec.ts
@@ -273,10 +273,10 @@ const testCases: TestsCase[] = [
await expect(navigationLink).not.toBeVisible();
// Find and click the chevron element that is next to "Editor" in the TOC
- // It is a span inside the link
+ // It is a button inside the link
const editorChevron = page
.getByRole('link', { name: 'Editor' })
- .locator('span');
+ .locator('button');
await editorChevron.click();
// Verify "Navigation" link becomes visible after expansion
@@ -295,10 +295,10 @@ const testCases: TestsCase[] = [
await expect(navigationLink).not.toBeVisible();
// Find and click the chevron element that is next to "Editor" in the TOC
- // It is a span inside the link
+ // It is a button inside the link
const editorChevron = page
.getByRole('link', { name: 'Editor' })
- .locator('span');
+ .locator('button');
await editorChevron.click();
// At this stage the link should still not be visible
@@ -307,7 +307,7 @@ const testCases: TestsCase[] = [
// Then we click 'Content Structure' chevron to expand further
const contentStructureChevron = page
.getByRole('link', { name: 'Content Structure' })
- .locator('span');
+ .locator('button');
await contentStructureChevron.click();
// Verify "Spaces" link becomes visible after expansion
diff --git a/packages/gitbook/src/components/DocumentView/CodeBlock/ClientCodeBlock.tsx b/packages/gitbook/src/components/DocumentView/CodeBlock/ClientCodeBlock.tsx
index b9d79be41..09219f191 100644
--- a/packages/gitbook/src/components/DocumentView/CodeBlock/ClientCodeBlock.tsx
+++ b/packages/gitbook/src/components/DocumentView/CodeBlock/ClientCodeBlock.tsx
@@ -6,7 +6,7 @@ import { useEffect, useId, useMemo, useRef, useState } from 'react';
import { useAdaptiveVisitor } from '@/components/Adaptive';
import { useInViewportListener } from '@/components/hooks/useInViewportListener';
import { useScrollListener } from '@/components/hooks/useScrollListener';
-import { Button } from '@/components/primitives';
+import { Button, ToggleChevron } from '@/components/primitives';
import { t, useLanguage } from '@/intl/client';
import { tcls } from '@/lib/tailwind';
import { useDebounceCallback } from 'usehooks-ts';
@@ -183,7 +183,7 @@ function CodeBlockExpandable(props: {
}
size="xsmall"
variant="blank"
type="button"
diff --git a/packages/gitbook/src/components/DocumentView/Expandable/Expandable.tsx b/packages/gitbook/src/components/DocumentView/Expandable/Expandable.tsx
index 8a3de8f41..cee18e19a 100644
--- a/packages/gitbook/src/components/DocumentView/Expandable/Expandable.tsx
+++ b/packages/gitbook/src/components/DocumentView/Expandable/Expandable.tsx
@@ -4,6 +4,7 @@ import { Icon } from '@gitbook/icons';
import { getNodeFragmentByType } from '@/lib/document';
import { tcls } from '@/lib/tailwind';
+import { ToggleChevron } from '@/components/primitives';
import type { BlockProps } from '../Block';
import { Blocks } from '../Blocks';
import { Inlines } from '../Inlines';
@@ -46,14 +47,14 @@ export function Expandable(props: BlockProps) {
'[&::-webkit-details-marker]:hidden'
)}
>
- ) {
{...rest}
>
{title}
- {isDropdown ? : null}
+ {isDropdown ? : null}
);
}
@@ -195,7 +194,7 @@ function HeaderItemDropdown(
{...rest}
>
{title}
-
+
);
}
diff --git a/packages/gitbook/src/components/Header/HeaderLinkMore.tsx b/packages/gitbook/src/components/Header/HeaderLinkMore.tsx
index 073ba34af..5e526cca8 100644
--- a/packages/gitbook/src/components/Header/HeaderLinkMore.tsx
+++ b/packages/gitbook/src/components/Header/HeaderLinkMore.tsx
@@ -10,12 +10,8 @@ import type React from 'react';
import { resolveContentRef } from '@/lib/references';
import { tcls } from '@/lib/tailwind';
-import {
- DropdownChevron,
- DropdownMenu,
- DropdownMenuItem,
- DropdownSubMenu,
-} from '../primitives/DropdownMenu';
+import { ToggleChevron } from '../primitives';
+import { DropdownMenu, DropdownMenuItem, DropdownSubMenu } from '../primitives/DropdownMenu';
import styles from './headerLinks.module.css';
/**
@@ -44,7 +40,7 @@ export function HeaderLinkMore(props: {
>
{label}
-
+
);
diff --git a/packages/gitbook/src/components/Header/SpacesDropdown.tsx b/packages/gitbook/src/components/Header/SpacesDropdown.tsx
index 4224ea26f..d4a628dbe 100644
--- a/packages/gitbook/src/components/Header/SpacesDropdown.tsx
+++ b/packages/gitbook/src/components/Header/SpacesDropdown.tsx
@@ -4,8 +4,8 @@ import { useMemo } from 'react';
import type { GitBookSiteContext } from '@/lib/context';
import { getSiteSpaceURL } from '@/lib/sites';
import { tcls } from '@/lib/tailwind';
-import { Button, type ButtonProps } from '../primitives';
-import { DropdownChevron, DropdownMenu } from '../primitives/DropdownMenu';
+import { Button, type ButtonProps, ToggleChevron } from '../primitives';
+import { DropdownMenu } from '../primitives/DropdownMenu';
import { SpacesDropdownMenuItems } from './SpacesDropdownMenuItem';
// Memoized regex for checking if a string starts with an emoji
@@ -37,7 +37,7 @@ export function SpacesDropdown(props: {
data-testid="space-dropdown-button"
size="small"
variant={variant}
- trailing={}
+ trailing={}
className={tcls('bg-tint-base', className)}
>
{siteSpace.title}
diff --git a/packages/gitbook/src/components/PageActions/PageActionsDropdown.tsx b/packages/gitbook/src/components/PageActions/PageActionsDropdown.tsx
index f2c66e641..2a041ea74 100644
--- a/packages/gitbook/src/components/PageActions/PageActionsDropdown.tsx
+++ b/packages/gitbook/src/components/PageActions/PageActionsDropdown.tsx
@@ -4,9 +4,9 @@ import { Button, ButtonGroup } from '@/components/primitives/Button';
import { DropdownMenu, DropdownMenuSeparator } from '@/components/primitives/DropdownMenu';
import { tString, useLanguage } from '@/intl/client';
import type { GitSyncState, SiteCustomizationSettings } from '@gitbook/api';
-import { Icon } from '@gitbook/icons';
import React, { useRef } from 'react';
import { useAI } from '../AI';
+import { ToggleChevron } from '../primitives';
import {
ActionCopyMCPURL,
ActionCopyMarkdown,
@@ -51,18 +51,13 @@ export function PageActionsDropdown(props: PageActionsDropdownProps) {
return defaultAction || dropdownActions.length > 0 ? (
{defaultAction}
- {dropdownActions.length > 0 ? (
+ {!defaultAction || dropdownActions.length > 1 ? (
- }
+ icon={}
label={tString(language, defaultAction ? 'more' : 'actions')}
iconOnly={!!defaultAction}
size="xsmall"
diff --git a/packages/gitbook/src/components/PageBody/PageHeader.tsx b/packages/gitbook/src/components/PageBody/PageHeader.tsx
index a4cb9218c..81ee8e18b 100644
--- a/packages/gitbook/src/components/PageBody/PageHeader.tsx
+++ b/packages/gitbook/src/components/PageBody/PageHeader.tsx
@@ -28,6 +28,14 @@ export async function PageHeader(props: {
const hasAncestors = ancestors.length > 0;
+ // Show page actions if *any* of the actions are enabled
+ const hasPageActions = [
+ ...Object.values(context.customization.pageActions),
+ context.customization.pdf.enabled,
+ context.customization.git.showEditLink,
+ withRSSFeed,
+ ].some(Boolean);
+
return (
- {page.layout.tableOfContents ? (
- // Show page actions if *any* of the actions are enabled
+ {page.layout.tableOfContents && hasPageActions ? (
}
+ trailing={}
/>
}
>
@@ -123,7 +123,7 @@ function SearchScopeVariantControl(props: SearchScopeControlProps & { isExtended
isExtended ? 'search_scope_variant_all' : 'search_scope_variant_current',
spaceTitle ?? ''
)}
- trailing={}
+ trailing={}
/>
}
>
diff --git a/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx b/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx
index 5254a7606..9dc149203 100644
--- a/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx
+++ b/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx
@@ -1,13 +1,13 @@
'use client';
-import { Icon, type IconName } from '@gitbook/icons';
+import type { IconName } from '@gitbook/icons';
import { motion } from 'motion/react';
import React from 'react';
import { type ClassValue, tcls } from '@/lib/tailwind';
import { findSectionInGroup } from '@/lib/utils';
import { useToggleAnimation } from '../hooks';
-import { Link } from '../primitives';
+import { Link, ToggleChevron } from '../primitives';
import { ScrollContainer } from '../primitives/ScrollContainer';
import { SectionIcon } from './SectionIcon';
import type {
@@ -199,21 +199,18 @@ export function SiteSectionGroupItem(props: {
isActiveGroup && 'hover:bg-tint-hover'
)}
>
-
diff --git a/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx b/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx
index 0e26edeac..3f98fe3cf 100644
--- a/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx
+++ b/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx
@@ -4,7 +4,7 @@ import type { IconName } from '@gitbook/icons';
import * as NavigationMenu from '@radix-ui/react-navigation-menu';
import React from 'react';
-import { Button, DropdownChevron, Link } from '@/components/primitives';
+import { Button, Link, ToggleChevron } from '@/components/primitives';
import { tcls } from '@/lib/tailwind';
import { findSectionInGroup } from '@/lib/utils';
import { useIsMobile } from '../hooks/useIsMobile';
@@ -188,7 +188,7 @@ const SectionTab = React.forwardRef(function SectionTab(
{...rest}
icon={icon ? : null}
label={title}
- trailing={isGroup ? : null}
+ trailing={isGroup ? : null}
active={isActive}
className={tcls(
'group/dropdown relative my-1.5 overflow-visible',
diff --git a/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx b/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx
index 13b398887..7bd05e409 100644
--- a/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx
+++ b/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx
@@ -38,14 +38,8 @@ export function PageDocumentItem(props: { page: ClientTOCPageDocument }) {
) : null
}
>
- {page.emoji || page.icon ? (
-
-
- {page.title}
-
- ) : (
- page.title
- )}
+
+ {page.title}
);
diff --git a/packages/gitbook/src/components/TableOfContents/PageLinkItem.tsx b/packages/gitbook/src/components/TableOfContents/PageLinkItem.tsx
index bf14adf9d..04d14ef94 100644
--- a/packages/gitbook/src/components/TableOfContents/PageLinkItem.tsx
+++ b/packages/gitbook/src/components/TableOfContents/PageLinkItem.tsx
@@ -12,11 +12,13 @@ import { TOCPageIcon } from './TOCPageIcon';
export function PageLinkItem(props: { page: ClientTOCPageLink }) {
const { page } = props;
+ const isExternal = page.target.kind === 'url';
+
return (