-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tabs): adds tabs ctx and first props (intent and size)
- Loading branch information
Showing
6 changed files
with
137 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* eslint-disable tailwindcss/no-custom-classname */ | ||
import { cva, type VariantProps } from 'class-variance-authority' | ||
|
||
export const tabsTriggerVariants = cva( | ||
[ | ||
'px-lg', | ||
'border-b-sm border-outline', | ||
'relative', | ||
'after:content after:left-none after:right-none after:h-sz-2 after:absolute after:bottom-[-1px]', | ||
'outline-none', | ||
'focus-visible:ring-outline-high ring-inset focus-visible:border-none focus-visible:ring-2', | ||
], | ||
{ | ||
variants: { | ||
intent: { | ||
primary: ['spark-state-active:text-primary spark-state-active:after:bg-primary'], | ||
secondary: ['spark-state-active:text-secondary spark-state-active:after:bg-secondary'], | ||
}, | ||
size: { | ||
xs: ['h-sz-32 text-caption'], | ||
sm: ['h-sz-36 text-body-2'], | ||
md: ['h-sz-40 text-body-1'], | ||
}, | ||
}, | ||
defaultVariants: { | ||
intent: 'primary', | ||
size: 'md', | ||
}, | ||
} | ||
) | ||
|
||
export type TabsTriggerVariantsProps = VariantProps<typeof tabsTriggerVariants> | ||
// { | ||
// intent?: 'primary'|'secondary' | ||
// size?: 'xs'|'sm'|'md' | ||
// } |
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,17 @@ | ||
import { createContext, useContext } from 'react' | ||
|
||
import { TabsTriggerVariantsProps } from './Tabs.styles' | ||
|
||
export type TabsContextInterface = TabsTriggerVariantsProps | ||
|
||
export const TabsContext = createContext<TabsContextInterface>({}) | ||
|
||
export const useTabsContext = () => { | ||
const context = useContext(TabsContext) | ||
|
||
if (!context) { | ||
throw Error('useTabsContext must be used within a TabsContext Provider') | ||
} | ||
|
||
return context | ||
} |
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