Skip to content

Commit f7f4df6

Browse files
authored
Fix nav tab-stick position (calcom#27097)
1 parent 8c39210 commit f7f4df6

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

apps/web/modules/event-types/components/EventTypeLayout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ function EventTypeSingleLayout({
296296
className="primary-navigation w-64"
297297
tabs={EventTypeTabs}
298298
sticky
299+
stickyOffset="var(--navbar-height, 64px)"
299300
linkShallow
300301
itemClassname="items-start"
301302
/>

packages/ui/components/navigation/tabs/VerticalTabs.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface NavTabProps {
1010
children?: React.ReactNode;
1111
className?: string;
1212
sticky?: boolean;
13+
stickyOffset?: number | string;
1314
linkShallow?: boolean;
1415
linkScroll?: boolean;
1516
itemClassname?: string;
@@ -20,6 +21,7 @@ const NavTabs = function ({
2021
tabs,
2122
className = "",
2223
sticky,
24+
stickyOffset = 24,
2325
linkShallow,
2426
linkScroll,
2527
itemClassname,
@@ -28,17 +30,13 @@ const NavTabs = function ({
2830
}: NavTabProps) {
2931
return (
3032
<nav
31-
className={classNames(
32-
`no-scrollbar flex flex-col stack-y-1 overflow-scroll ${className}`,
33-
sticky && "sticky top-0 -mt-7"
34-
)}
33+
className={classNames(`no-scrollbar flex flex-col stack-y-1 overflow-scroll ${className}`, sticky && "sticky")}
3534
style={{
3635
maxWidth: "256px",
36+
...(sticky ? { top: stickyOffset } : {}),
3737
}}
3838
aria-label="Tabs"
3939
{...props}>
40-
{/* padding top for sticky */}
41-
{sticky && <div className="pt-6" />}
4240
{props.children}
4341
{tabs.map((tab, idx) => (
4442
<VerticalTabItem

packages/ui/components/navigation/tabs/navigation.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ describe("Navigation Components", () => {
158158
}
159159
});
160160

161-
// Check sticky behavior
161+
// Check sticky behavior with default offset
162162
await expect(container.firstChild).toHaveClass("sticky");
163+
await expect(container.firstChild).toHaveStyle("top: 24px");
163164
});
164165

165166
test("applies custom icon correctly", async () => {

0 commit comments

Comments
 (0)