@@ -10,12 +10,15 @@ const CustomDropdown = ({
1010 icon : Icon ,
1111 label,
1212 className = '' ,
13+ variant = 'default' ,
1314} ) => {
1415 const [ isOpen , setIsOpen ] = useState ( false ) ;
1516 const dropdownRef = useRef ( null ) ; // Ref for the button
1617 const menuRef = useRef ( null ) ; // Ref for the dropdown menu
1718 const [ dropdownMenuPosition , setDropdownMenuPosition ] = useState ( { } ) ;
1819
20+ const isBrutalist = variant === 'brutalist' ;
21+
1922 useEffect ( ( ) => {
2023 const handleClickOutside = ( event ) => {
2124 const isClickInsideButton =
@@ -63,7 +66,11 @@ const CustomDropdown = ({
6366 animate = { { opacity : 1 , y : 0 , scale : 1 } }
6467 exit = { { opacity : 0 , y : - 10 , scale : 0.95 } }
6568 transition = { { duration : 0.1 } }
66- className = "bg-gray-800 border border-gray-700 rounded-md shadow-lg z-50 origin-top-left max-h-80 overflow-y-auto" // Added max-h-80 and overflow-y-auto
69+ className = { `${
70+ isBrutalist
71+ ? "bg-[#050505] border border-white/10 rounded-sm"
72+ : "bg-gray-800 border border-gray-700 rounded-md shadow-lg"
73+ } z-[1000] origin-top-left max-h-80 overflow-y-auto`}
6774 style = { {
6875 position : 'absolute' ,
6976 top : dropdownMenuPosition . top ,
@@ -72,20 +79,28 @@ const CustomDropdown = ({
7279 width : 'max-content' , // Allow content to determine width, but respect minWidth
7380 } }
7481 >
75- < div className = " py-1">
82+ < div className = { isBrutalist ? "p-1" : " py-1"} >
7683 { options . map ( ( option ) => (
7784 < button
7885 key = { option . value }
7986 onClick = { ( ) => handleSelect ( option . value ) }
80- className = { `flex items-center justify-between w-full px-4 py-2 text-sm text-left transition-colors ${
81- value === option . value
82- ? 'bg-primary-500/10 text-primary-400'
83- : 'text-gray-300 hover:bg-gray-700 hover:text-white'
87+ className = { `flex items-center justify-between w-full px-4 py-2 text-left transition-colors ${
88+ isBrutalist
89+ ? `text-xs font-mono uppercase tracking-widest ${
90+ value === option . value
91+ ? 'bg-white/10 text-emerald-400'
92+ : 'text-gray-400 hover:bg-white/5 hover:text-white'
93+ } `
94+ : `text-sm ${
95+ value === option . value
96+ ? 'bg-primary-500/10 text-primary-400'
97+ : 'text-gray-300 hover:bg-gray-700 hover:text-white'
98+ } `
8499 } `}
85100 >
86101 < span > { option . label } </ span >
87102 { value === option . value && (
88- < Check size = { 16 } className = "text-primary-400" />
103+ < Check size = { isBrutalist ? 12 : 16 } className = { isBrutalist ? "text-emerald-400" : "text- primary-400"} />
89104 ) }
90105 </ button >
91106 ) ) }
@@ -101,14 +116,18 @@ const CustomDropdown = ({
101116 type = "button"
102117 ref = { dropdownRef } // Attach ref to the button
103118 onClick = { ( ) => setIsOpen ( ! isOpen ) }
104- className = "flex items-center justify-between w-full gap-2 px-4 py-2 bg-gray-800 hover:bg-gray-700 border border-gray-700 rounded-md text-sm font-medium text-gray-200 transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-900 focus:ring-primary-500"
119+ className = { `flex items-center justify-between w-full gap-2 px-4 py-2 transition-all focus:outline-none ${
120+ isBrutalist
121+ ? "bg-transparent border border-gray-800 rounded-sm text-xs font-mono uppercase tracking-widest text-gray-400 hover:border-gray-600 hover:text-white"
122+ : "bg-gray-800 hover:bg-gray-700 border border-gray-700 rounded-md text-sm font-medium text-gray-200 focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-900 focus:ring-primary-500"
123+ } `}
105124 >
106125 < div className = "flex items-center gap-2" >
107- { Icon && < Icon size = { 20 } className = "text-gray-400" /> }
126+ { Icon && < Icon size = { isBrutalist ? 16 : 20 } className = { isBrutalist ? "text-emerald-500" : "text- gray-400"} /> }
108127 < span > { selectedOption ? selectedOption . label : label } </ span >
109128 </ div >
110129 < CaretDown
111- size = { 16 }
130+ size = { isBrutalist ? 12 : 16 }
112131 className = { `ml-2 transition-transform duration-200 ${ isOpen ? 'rotate-180' : '' } ` }
113132 />
114133 </ button >
0 commit comments