1
- import React from "react "
2
- import { Flex , type FlexProps , Text } from "@chakra- ui/react "
1
+ import { Button } from "@/components/ui/buttons/Button "
2
+ import { Flex , type FlexProps } from "@/components/ ui/flex "
3
3
4
- import { Button } from "../../Buttons "
4
+ import { cn } from "@/lib/utils/cn "
5
5
6
6
type CategoryTabsProps = FlexProps & {
7
7
categories : Array < string >
@@ -12,31 +12,32 @@ export const CategoryTabs = ({
12
12
categories,
13
13
activeIndex = 0 ,
14
14
setActiveIndex,
15
+ className,
15
16
...flexProps
16
17
} : CategoryTabsProps ) => (
17
- < Flex gap = { 6 } { ...flexProps } >
18
- { categories . map ( ( category , index ) =>
19
- setActiveIndex ? (
18
+ < Flex className = { cn ( "gap-6" , className ) } { ...flexProps } >
19
+ { categories . map ( ( category , index ) => {
20
+ const isActiveIndex = activeIndex === index
21
+ const fontWeightClass = isActiveIndex && "font-bold"
22
+ return setActiveIndex ? (
20
23
< Button
21
24
key = { category }
22
25
variant = "ghost"
23
- fontWeight = { activeIndex === index ? "bold" : "normal" }
26
+ className = { cn (
27
+ fontWeightClass ,
28
+ "p-0 pb-2 text-body" ,
29
+ isActiveIndex && "!text-[initial]"
30
+ ) }
31
+ disabled = { isActiveIndex }
24
32
onClick = { ( ) => setActiveIndex ( index ) }
25
- p = { 0 }
26
- pb = { 2 }
27
- color = "body.base"
28
33
>
29
34
{ category }
30
35
</ Button >
31
36
) : (
32
- < Text
33
- mb = { 2 }
34
- key = { category }
35
- fontWeight = { activeIndex === index ? "bold" : "normal" }
36
- >
37
+ < p className = { cn ( fontWeightClass , "mb-2" ) } key = { category } >
37
38
{ category }
38
- </ Text >
39
+ </ p >
39
40
)
40
- ) }
41
+ } ) }
41
42
</ Flex >
42
43
)
0 commit comments