Skip to content

Commit

Permalink
Use ellipsis and fix icon color for more links in the header on small…
Browse files Browse the repository at this point in the history
… screen (#2455)
  • Loading branch information
SamyPesse authored Sep 6, 2024
1 parent 4cbcc5b commit 13c7534
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-gifts-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gitbook': patch
---

Use ellipsis and fix icon color for more links in the header on small screen
Binary file modified bun.lockb
Binary file not shown.
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,5 @@
},
"patchedDependencies": {
"@vercel/[email protected]": "patches/@vercel%[email protected]"
},
"dependencies": {
"@scalar/api-client-react": "0.3.7"
}
}
1 change: 1 addition & 0 deletions packages/gitbook/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export function Header(props: {
label={t(getSpaceLanguage(customization), 'more')}
links={customization.header.links}
context={context}
customization={customization}
/>
</HeaderLinks>
<div
Expand Down
29 changes: 24 additions & 5 deletions packages/gitbook/src/components/Header/HeaderLinkMore.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import { CustomizationHeaderLink } from '@gitbook/api';
import {
CustomizationHeaderLink,
CustomizationHeaderPreset,
CustomizationSettings,
SiteCustomizationSettings,
} from '@gitbook/api';
import { Icon } from '@gitbook/icons';
import React from 'react';

import { ContentRefContext, resolveContentRef } from '@/lib/references';
import { tcls } from '@/lib/tailwind';

import { Dropdown, DropdownChevron, DropdownMenu, DropdownMenuItem } from './Dropdown';
import { Dropdown, DropdownMenu, DropdownMenuItem } from './Dropdown';
import styles from './headerLinks.module.css';

/**
Expand All @@ -13,13 +20,25 @@ export function HeaderLinkMore(props: {
label: React.ReactNode;
links: CustomizationHeaderLink[];
context: ContentRefContext;
customization: CustomizationSettings | SiteCustomizationSettings;
}) {
const { label, links, context } = props;
const { label, links, context, customization } = props;

const isCustomizationDefault =
customization.header.preset === CustomizationHeaderPreset.Default;

const renderButton = () => (
<button className="px-1">
<button
className={tcls(
'px-1',
!isCustomizationDefault
? ['text-header-link-500']
: ['text-dark/8', 'dark:text-light/8', 'dark:hover:text-light'],
'hover:text-header-link-400',
)}
>
<span className="sr-only">{label}</span>
<DropdownChevron />
<Icon icon="ellipsis" className={tcls('opacity-6', 'size-3', 'ms-1')} />
</button>
);

Expand Down

0 comments on commit 13c7534

Please sign in to comment.