Skip to content

Commit 935e24d

Browse files
committed
Formatting
1 parent 89896f9 commit 935e24d

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

packages/gitbook/src/components/SiteSectionTabs/SiteSectionTabs.tsx

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export function SiteSectionTabs(props: { sections: SiteSection[]; section: SiteS
2222
const currentTabRef = React.useRef<HTMLAnchorElement>(null);
2323
const navRef = React.useRef<HTMLDivElement>(null);
2424

25-
// we don't set the current tab with a click event because the tab will navigate to a different section and trigger a page reload.
26-
const currentIndex = sections.findIndex((section) => section.id === currentSection?.id);
25+
// we don't set the current tab with a click event because the tab will navigate to a different section and trigger a page reload.
26+
const currentIndex = sections.findIndex((section) => section.id === currentSection?.id);
2727

2828
const [tabDimensions, setTabDimensions] = React.useState<{
2929
left: number;
@@ -48,7 +48,7 @@ export function SiteSectionTabs(props: { sections: SiteSection[]; section: SiteS
4848
() => {
4949
window.removeEventListener('resize', updateTabDimensions);
5050
window.removeEventListener('load', updateTabDimensions);
51-
}
51+
};
5252
}, [updateTabDimensions]);
5353

5454
const opacity = Boolean(tabDimensions) ? 1 : 0.0;
@@ -114,28 +114,27 @@ export function SiteSectionTabs(props: { sections: SiteSection[]; section: SiteS
114114
/**
115115
* The tab item - a link to a site section
116116
*/
117-
const Tab = React.forwardRef<
118-
HTMLSpanElement,
119-
{ active: boolean; href: string; label: string; }
120-
>(function Tab(props, ref) {
121-
const { active, href, label } = props;
122-
return (
123-
<Link
124-
className={tcls(
125-
'px-3 py-1 my-2 rounded straight-corners:rounded-none transition-colors',
126-
active && 'text-primary dark:text-primary-400',
127-
!active &&
128-
'text-dark/8 hover:bg-dark/1 hover:text-dark/9 dark:text-light/8 dark:hover:bg-light/2 dark:hover:text-light/9',
129-
)}
130-
role="tab"
131-
href={href}
132-
>
133-
<span ref={ref} className={tcls('inline-flex w-full truncate')}>
134-
{label}
135-
</span>
136-
</Link>
137-
);
138-
});
117+
const Tab = React.forwardRef<HTMLSpanElement, { active: boolean; href: string; label: string }>(
118+
function Tab(props, ref) {
119+
const { active, href, label } = props;
120+
return (
121+
<Link
122+
className={tcls(
123+
'px-3 py-1 my-2 rounded straight-corners:rounded-none transition-colors',
124+
active && 'text-primary dark:text-primary-400',
125+
!active &&
126+
'text-dark/8 hover:bg-dark/1 hover:text-dark/9 dark:text-light/8 dark:hover:bg-light/2 dark:hover:text-light/9',
127+
)}
128+
role="tab"
129+
href={href}
130+
>
131+
<span ref={ref} className={tcls('inline-flex w-full truncate')}>
132+
{label}
133+
</span>
134+
</Link>
135+
);
136+
},
137+
);
139138

140139
/**
141140
* Dropdown trigger for when there are too many sections to show them all

0 commit comments

Comments
 (0)