diff --git a/src/components/TabbedNav/TabbedNav.tsx b/src/components/TabbedNav/TabbedNav.tsx index e12da635..05fc0384 100644 --- a/src/components/TabbedNav/TabbedNav.tsx +++ b/src/components/TabbedNav/TabbedNav.tsx @@ -1,11 +1,50 @@ -import { clsx } from 'clsx' +import { cva, VariantProps } from 'class-variance-authority' import { ComponentType, MouseEvent, ReactNode, useState } from 'react' -import { Box, PolymorphicProps } from '~/components/Box' import { Button } from '~/components/Button' import { IconProps } from '~/icons/types' - -import { tabList, tabVariants, TabVariants } from './styles.css' +import { cn } from '~/utils' + +const tabVariants = cva([''], { + variants: { + variant: { + pill: '', + line: 'leading-5 text-[0.625rem] tracking-[0.8px]', + }, + active: { + true: 'hover:opacity-100', + false: '', + }, + disabled: { + true: 'opacity-50', + }, + }, + compoundVariants: [ + { + variant: 'pill', + active: true, + className: 'bg-button-inverse text-text-inverse-100', + }, + { + variant: 'pill', + active: false, + className: 'bg-transparent text-text-80', + }, + { + variant: 'line', + active: true, + className: 'text-text-100', + }, + { + variant: 'line', + active: false, + className: 'text-text-80', + }, + ], + defaultVariants: { + variant: 'pill', + }, +}) export type TabOption = { label: ReactNode @@ -15,14 +54,16 @@ export type TabOption = { onLoad?: () => boolean | Promise } -type TabbedNavProps = { +interface TabbedNavProps + extends React.HTMLAttributes, + VariantProps { defaultValue?: string size?: 'xs' | 'sm' tabs: TabOption[] onTabChange?: (value: string) => void -} & TabVariants +} -export const TabbedNav = (props: PolymorphicProps) => { +export const TabbedNav = (props: TabbedNavProps) => { const { className, defaultValue, @@ -65,29 +106,26 @@ export const TabbedNav = (props: PolymorphicProps) => { } return ( - - + ) }