Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/spicy-trainers-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gitbook": patch
---

Fix button content truncate
5 changes: 2 additions & 3 deletions packages/gitbook/src/components/AIChat/AIChatButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';
import { useLanguage } from '@/intl/client';
import { t } from '@/intl/translate';
import { tcls } from '@/lib/tailwind';
import type { Assistant } from '../AI';
import { Button } from '../primitives';
import { KeyboardShortcut } from '../primitives/KeyboardShortcut';
Expand All @@ -24,7 +23,7 @@ export function AIChatButton(props: {
iconOnly={!showLabel}
size="medium"
variant="header"
className={tcls('h-9 px-2.5')}
className="h-9 px-2.5 max-md:[&_.button-content]:hidden"
label={
<div className="flex items-center gap-2">
{t(language, 'ai_chat_ask', assistant.label)}
Expand All @@ -38,7 +37,7 @@ export function AIChatButton(props: {
}
onClick={() => assistant.open()}
>
{showLabel ? <span className="max-md:hidden">{t(language, 'ask')}</span> : null}
{showLabel ? t(language, 'ask') : null}
</Button>
);
}
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/Search/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const SearchInput = React.forwardRef<HTMLDivElement, SearchInputProps>(
'has-[input:focus]:-translate-y-px h-9 grow cursor-pointer px-2.5 has-[input:focus]:bg-tint-base has-[input:focus]:depth-subtle:shadow-lg has-[input:focus]:depth-subtle:shadow-primary-subtle has-[input:focus-visible]:ring-2 has-[input:focus-visible]:ring-primary-hover md:cursor-text',
'theme-bold:border-header-link/3 has-[input:focus-visible]:theme-bold:border-header-link/5 has-[input:focus-visible]:theme-bold:bg-header-link/3 has-[input:focus-visible]:theme-bold:ring-header-link/5',
'theme-bold:before:absolute theme-bold:before:inset-0 theme-bold:before:bg-header-background/7 theme-bold:before:backdrop-blur-xl ', // Special overlay to make the transparent colors of theme-bold visible.
'relative z-30 shrink grow justify-start max-md:absolute max-md:right-0',
'relative z-30 max-w-none shrink grow justify-start max-md:absolute max-md:right-0',
isOpen ? 'max-md:w-56' : 'max-md:w-[38px]'
)}
>
Expand Down
4 changes: 3 additions & 1 deletion packages/gitbook/src/components/primitives/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ export const Button = React.forwardRef<
icon
)
) : null}
{iconOnly ? null : (children ?? label)}
{iconOnly || (!children && !label) ? null : (
<span className="button-content truncate">{children ?? label}</span>
)}
</>
);

Expand Down
1 change: 1 addition & 0 deletions packages/gitbook/src/components/primitives/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const ButtonStyles = [
'grow-0',
'shrink-0',
'truncate',
'max-w-full',

'disabled:cursor-not-allowed',
'disabled:translate-y-0!',
Expand Down