From 66475cefafc0a09ad0cdd187c3b073a0e5a7e18d Mon Sep 17 00:00:00 2001 From: Zeno Kapitein Date: 2025年10月22日 13:15:57 +0200 Subject: [PATCH 1/3] Tweak language dropdown styling --- .changeset/quiet-comics-act.md | 5 ++++ .../gitbook/src/components/Header/Header.tsx | 13 +++++---- .../src/components/Header/SpacesDropdown.tsx | 2 +- .../SiteSections/SiteSectionTabs.tsx | 7 +++-- .../components/primitives/ScrollContainer.tsx | 27 ++++++++++++++++--- 5 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 .changeset/quiet-comics-act.md diff --git a/.changeset/quiet-comics-act.md b/.changeset/quiet-comics-act.md new file mode 100644 index 0000000000..b3ed43a649 --- /dev/null +++ b/.changeset/quiet-comics-act.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Tweak language dropdown styling diff --git a/packages/gitbook/src/components/Header/Header.tsx b/packages/gitbook/src/components/Header/Header.tsx index 38529ac070..999c4d1fd2 100644 --- a/packages/gitbook/src/components/Header/Header.tsx +++ b/packages/gitbook/src/components/Header/Header.tsx @@ -188,13 +188,12 @@ export function Header(props: {
{withVariants === 'translations' ? ( -
-
-
+
) : null}
diff --git a/packages/gitbook/src/components/Header/SpacesDropdown.tsx b/packages/gitbook/src/components/Header/SpacesDropdown.tsx index 1d6dd2773f..bb72f1e2a9 100644 --- a/packages/gitbook/src/components/Header/SpacesDropdown.tsx +++ b/packages/gitbook/src/components/Header/SpacesDropdown.tsx @@ -76,7 +76,7 @@ export function TranslationsDropdown(props: { siteSpaces={siteSpaces} variant="blank" className={tcls( - '-mx-2 bg-transparent px-2 md:py-1 lg:max-w-64 max-md:[&_.button-content]:hidden', + 'bg-transparent px-2 md:py-1 lg:max-w-64 max-md:[&_.button-content]:hidden', hasEmojiPrefix ? 'md:[&_.button-leading-icon]:hidden' // If the title starts with an emoji, don't show the icon (on desktop) : '', diff --git a/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx b/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx index dce92e949e..7d4926b3bb 100644 --- a/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx +++ b/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx @@ -67,15 +67,18 @@ export function SiteSectionTabs(props: { className={tcls( 'grow', 'md:-ml-8 -ml-4 sm:-ml-6', - !children ? 'md:-mr-8 -mr-4 sm:-mr-6' : '' + !children + ? 'md:-mr-8 -mr-4 sm:-mr-6' + : 'after:contents[] after:absolute after:inset-y-2 after:right-0 after:border-transparent after:border-r' )} activeId={currentSection.id} + trailingEdgeClassName={children ? 'after:border-tint' : ''} > ; export function ScrollContainer(props: ScrollContainerProps) { - const { children, className, orientation, activeId, ...rest } = props; + const { + children, + className, + orientation, + activeId, + leadingEdgeClassName, + trailingEdgeClassName, + ...rest + } = props; const containerRef = React.useRef(null); @@ -110,7 +124,12 @@ export function ScrollContainer(props: ScrollContainerProps) { return (
0 ? leadingEdgeClassName : '', + scrollPosition < scrollSize ? trailingEdgeClassName : '' + )} {...rest}> {/* Scrollable content */} @@ -140,7 +159,7 @@ export function ScrollContainer(props: ScrollContainerProps) { icon={orientation === 'horizontal' ? 'chevron-left' : 'chevron-up'} iconOnly size="xsmall" - variant="secondary" + variant="header" tabIndex={-1} className={tcls( orientation === 'horizontal' @@ -158,7 +177,7 @@ export function ScrollContainer(props: ScrollContainerProps) { icon={orientation === 'horizontal' ? 'chevron-right' : 'chevron-down'} iconOnly size="xsmall" - variant="secondary" + variant="header" tabIndex={-1} className={tcls( orientation === 'horizontal' From 367f3e0ac4302e8af9a11b16f7cfe97861d80008 Mon Sep 17 00:00:00 2001 From: Zeno Kapitein Date: 2025年10月22日 13:21:18 +0200 Subject: [PATCH 2/3] Rename --- .../components/SiteSections/SiteSectionTabs.tsx | 2 +- .../components/primitives/ScrollContainer.tsx | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx b/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx index 7d4926b3bb..67e0809e8f 100644 --- a/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx +++ b/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx @@ -72,7 +72,7 @@ export function SiteSectionTabs(props: { : 'after:contents[] after:absolute after:inset-y-2 after:right-0 after:border-transparent after:border-r' )} activeId={currentSection.id} - trailingEdgeClassName={children ? 'after:border-tint' : ''} + trailingEdgeScrollClassName={children ? 'after:border-tint' : ''} > 0 ? leadingEdgeClassName : '', - scrollPosition < scrollSize ? trailingEdgeClassName : '' + scrollPosition> 0 ? leadingEdgeScrollClassName : '', + scrollPosition < scrollSize ? trailingEdgeScrollClassName : '' )} {...rest}> From 39738dcce2399508df259519cf3de3a48fccf3b9 Mon Sep 17 00:00:00 2001 From: Zeno Kapitein Date: 2025年10月22日 15:18:02 +0200 Subject: [PATCH 3/3] Alignment --- packages/gitbook/src/components/Header/SpacesDropdown.tsx | 2 +- .../gitbook/src/components/SiteSections/SiteSectionTabs.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/gitbook/src/components/Header/SpacesDropdown.tsx b/packages/gitbook/src/components/Header/SpacesDropdown.tsx index bb72f1e2a9..1d6dd2773f 100644 --- a/packages/gitbook/src/components/Header/SpacesDropdown.tsx +++ b/packages/gitbook/src/components/Header/SpacesDropdown.tsx @@ -76,7 +76,7 @@ export function TranslationsDropdown(props: { siteSpaces={siteSpaces} variant="blank" className={tcls( - 'bg-transparent px-2 md:py-1 lg:max-w-64 max-md:[&_.button-content]:hidden', + '-mx-2 bg-transparent px-2 md:py-1 lg:max-w-64 max-md:[&_.button-content]:hidden', hasEmojiPrefix ? 'md:[&_.button-leading-icon]:hidden' // If the title starts with an emoji, don't show the icon (on desktop) : '', diff --git a/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx b/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx index 67e0809e8f..9bf7be4a4c 100644 --- a/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx +++ b/packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx @@ -69,7 +69,7 @@ export function SiteSectionTabs(props: { 'md:-ml-8 -ml-4 sm:-ml-6', !children ? 'md:-mr-8 -mr-4 sm:-mr-6' - : 'after:contents[] after:absolute after:inset-y-2 after:right-0 after:border-transparent after:border-r' + : 'after:contents[] after:absolute after:inset-y-2 after:right-0 after:border-transparent after:border-r after:transition-colors' )} activeId={currentSection.id} trailingEdgeScrollClassName={children ? 'after:border-tint' : ''}

AltStyle によって変換されたページ (->オリジナル) /