-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa80328
commit 6b52b40
Showing
25 changed files
with
511 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Tab } from "@headlessui/react"; | ||
import { Fragment, HTMLAttributes, ReactNode } from "react"; | ||
import { Button } from "./Button"; | ||
import { cn } from "@/shared/utils"; | ||
|
||
interface TabProps extends HTMLAttributes<HTMLDivElement> { | ||
items: { | ||
label: string; | ||
children: ReactNode; | ||
}[]; | ||
} | ||
|
||
export const Tabs = ({ items, className }: TabProps) => { | ||
return ( | ||
<Tab.Group as={Fragment}> | ||
<div className={cn("flex flex-col", className)}> | ||
<Tab.List className="inline-flex mx-auto border border-primary rounded-[11px] p-1 gap-4"> | ||
{items?.map(({ label }, index) => { | ||
return ( | ||
<Tab as="div" key={index} className="outline-none"> | ||
{({ selected }) => ( | ||
/* Use the `selected` state to conditionally style the selected tab. */ | ||
<Button | ||
variant={selected ? "green" : "transparent"} | ||
className={cn( | ||
"uppercase !py-2 !px-4", | ||
!selected && "!text-primary" | ||
)} | ||
> | ||
{label} | ||
</Button> | ||
)} | ||
</Tab> | ||
); | ||
})} | ||
</Tab.List> | ||
<Tab.Panels className="pt-20"> | ||
{items?.map(({ children }, index) => { | ||
return <Tab.Panel key={index}>{children}</Tab.Panel>; | ||
})} | ||
</Tab.Panels> | ||
</div> | ||
</Tab.Group> | ||
); | ||
}; |
Oops, something went wrong.