#4110: Made vertical tabs in bookings and event types pages sticky. (#4145)

Co-authored-by: Jeroen Reumkens <jeroen.reumkens@deptagency.com>
This commit is contained in:
Jeroen Reumkens 2022-09-04 16:59:16 +02:00 committed by GitHub
parent 5e77b95e48
commit 93adf57d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -243,7 +243,7 @@ function EventTypeSingleLayout({
<ClientSuspense fallback={<Loader />}>
<div className="flex flex-col xl:flex-row xl:space-x-8">
<div className="hidden xl:block">
<VerticalTabs tabs={EventTypeTabs} />
<VerticalTabs tabs={EventTypeTabs} sticky />
</div>
<div className="p-2 md:p-0 xl:hidden">
<HorizontalTabs tabs={EventTypeTabs} />

View File

@ -42,7 +42,7 @@ export default function BookingLayout({
<Shell {...rest}>
<div className="flex flex-col p-2 md:p-0 xl:flex-row ">
<div className="hidden xl:block">
<VerticalTabs tabs={tabs} />
<VerticalTabs tabs={tabs} sticky />
</div>
<div className="block xl:hidden">
<HorizontalTabs tabs={tabs} />

View File

@ -1,16 +1,22 @@
import { FC } from "react";
import { classNames } from "@calcom/lib";
import VerticalTabItem, { VerticalTabItemProps } from "./VerticalTabItem";
export interface NavTabProps {
tabs: VerticalTabItemProps[];
children?: React.ReactNode;
className?: string;
sticky?: boolean;
}
const NavTabs: FC<NavTabProps> = ({ tabs, className = "", ...props }) => {
const NavTabs: FC<NavTabProps> = ({ tabs, className = "", sticky, ...props }) => {
return (
<nav className={`no-scrollbar flex flex-col space-y-1 ${className}`} aria-label="Tabs" {...props}>
<nav
className={classNames(`no-scrollbar flex flex-col space-y-1 ${className}`, sticky && "sticky top-0")}
aria-label="Tabs"
{...props}>
{props.children}
{tabs.map((tab, idx) => (
<VerticalTabItem {...tab} key={idx} />