1
1
import { forwardRef , ReactElement } from 'react'
2
2
3
3
import { Icon , Text } from '@/components'
4
+ import { useTheme } from '@/context/theme'
4
5
import { cn } from '@utils/cn'
5
6
6
7
export interface ItemProps {
@@ -16,12 +17,14 @@ export interface ItemProps {
16
17
17
18
export const Item = forwardRef < HTMLDivElement , ItemProps > (
18
19
( { icon, text, description, active, submenuItem = false , className, isMainNav, ...props } , ref ) => {
20
+ const { isInset, isLightTheme } = useTheme ( )
21
+
19
22
if ( submenuItem ) {
20
23
return (
21
24
< div
22
25
ref = { ref }
23
26
className = { cn (
24
- 'group relative grid cursor-pointer select-none grid-cols-[auto_1fr] items-center gap-3 pb-[0.6875rem] pt-[0.5625rem] py-2 px-3 rounded-md' ,
27
+ 'group relative grid cursor-pointer select-none grid-cols-[auto_1fr] items-center gap-3 pb-[0.6875rem] pt-[0.5625rem] py-2.5 px-3 rounded-md' ,
25
28
{ 'gap-0' : ! icon } ,
26
29
className
27
30
) }
@@ -41,6 +44,7 @@ export const Item = forwardRef<HTMLDivElement, ItemProps>(
41
44
className = { cn (
42
45
'sub-menu-icon-bg relative flex size-8 place-content-center place-items-center rounded border border-borders-1 bg-background-2' ,
43
46
{ 'border-sidebar-border-3 bg-sidebar-background-7' : isMainNav }
47
+ // { 'border-sidebar-border-6 bg-sidebar-background-8': active && isLightTheme }
44
48
) }
45
49
>
46
50
< Icon
@@ -63,6 +67,8 @@ export const Item = forwardRef<HTMLDivElement, ItemProps>(
63
67
weight = "medium"
64
68
className = { cn (
65
69
'text-foreground-2 group-hover:text-foreground-1 z-10 w-full duration-0 ease-in-out' ,
70
+ // { 'text-sidebar-foreground-2': isMainNav && (!isInset || isLightTheme) },
71
+ // { 'text-sidebar-foreground-3': isMainNav && isInset && !isLightTheme },
66
72
{ 'text-sidebar-foreground-2 group-hover:text-sidebar-foreground-1' : isMainNav } ,
67
73
{ 'text-foreground-1' : active } ,
68
74
{ 'text-sidebar-foreground-1' : active && isMainNav }
@@ -90,18 +96,24 @@ export const Item = forwardRef<HTMLDivElement, ItemProps>(
90
96
< div
91
97
ref = { ref }
92
98
className = { cn (
93
- 'group flex cursor-pointer select-none gap-2.5 py-1.5 px-3 rounded-md' ,
94
- { 'bg-background-4' : active } ,
95
- { 'bg-sidebar-background-3' : active && isMainNav } ,
99
+ 'group relative grid cursor-pointer select-none grid-cols-[auto_1fr] gap-2.5 py-1.5 px-2.5 rounded-md' ,
96
100
{ 'gap-0' : ! icon } ,
97
101
className
98
102
) }
99
103
{ ...props }
100
104
>
105
+ < div
106
+ className = { cn (
107
+ 'absolute z-0 h-full w-full rounded-[4px] bg-transparent transition-colors' ,
108
+ { 'group-hover:bg-sidebar-background-2' : isMainNav && ( isLightTheme || isInset ) } ,
109
+ { 'bg-background-4' : active } ,
110
+ { 'bg-sidebar-background-3' : active && isMainNav }
111
+ ) }
112
+ />
101
113
{ icon && (
102
114
< div
103
115
className = { cn (
104
- 'text-icons-4 group-hover:text-icons-2 relative z-10 mt-1 flex h-3 w-3 min-w-3 items-center duration-100 ease-in-out' ,
116
+ 'text-icons-4 group-hover:text-icons-2 relative z-10 flex h-3.5 w-3.5 min-w-3.5 mt-0.5 items-center duration-100 ease-in-out' ,
105
117
{ 'text-sidebar-icon-3 group-hover:text-sidebar-icon-1' : isMainNav } ,
106
118
{ 'text-icons-2' : active } ,
107
119
{ 'text-sidebar-icon-1' : active && isMainNav }
@@ -117,7 +129,7 @@ export const Item = forwardRef<HTMLDivElement, ItemProps>(
117
129
size = { 2 }
118
130
weight = "medium"
119
131
className = { cn (
120
- 'text-foreground-3 group-hover:text-foreground-1 z-10 text-left duration-100 ease-in-out' ,
132
+ 'text-foreground-3 group-hover:text-foreground-1 relative z-10 text-left duration-100 ease-in-out' ,
121
133
{ 'text-sidebar-foreground-2 group-hover:text-sidebar-foreground-1' : isMainNav } ,
122
134
{ 'text-foreground-1' : active } ,
123
135
{ 'text-sidebar-foreground-1' : active && isMainNav }
0 commit comments