-
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
Showing
8 changed files
with
155 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export function multipleVariant(variant: string, classNames: string | string[]) { | ||
const classNames_ = Array.isArray(classNames) ? classNames : classNames.split(' ').filter(Boolean) | ||
return classNames_.map((s) => `${variant}:${s}`).join(' ') | ||
} |
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,39 @@ | ||
import { type VariantProps, tv } from 'tailwind-variants' | ||
import { multipleVariant } from '../utils/tailwind' | ||
|
||
export const accordion = tv({ | ||
slots: { | ||
base: 'group', | ||
item: [ | ||
'group border-b border-border py-2', | ||
multipleVariant( | ||
'group-data-[accordion-variant=bordered]', | ||
'border bg-background px-4 py-1 first:rounded-t-lg last:rounded-b-lg' | ||
), | ||
multipleVariant( | ||
'group-data-[accordion-variant=splitted]', | ||
'rounded-lg border bg-background px-4 py-1' | ||
), | ||
], | ||
header: [ | ||
'flex flex-1 items-center justify-between py-2 text-left font-medium text-[15px] leading-6 group-open:[&>svg]:rotate-180', | ||
], | ||
panel: ['overflow-hidden text-sm'], | ||
}, | ||
variants: { | ||
variant: { | ||
light: {}, | ||
bordered: { | ||
base: '-space-y-px', | ||
}, | ||
splitted: { | ||
base: 'space-y-2', | ||
}, | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: 'light', | ||
}, | ||
}) | ||
|
||
export type AccordionVariantProps = VariantProps<typeof accordion> |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './accordion' | ||
export * from './alert' | ||
export * from './avatar' | ||
export * from './badge' | ||
|