@@ -304,21 +304,31 @@ export default function Problems() {
304304 </ div >
305305
306306 < div className = "flex gap-1" >
307- { difficultyOptions . map ( ( opt ) => (
308- < button
309- key = { opt . value }
310- onClick = { ( ) =>
311- updateParams ( { difficulty : opt . value , page : '' } )
312- }
313- className = { `px-3 py-1.5 rounded-md text-sm transition-colors ${
314- difficulty === opt . value
315- ? 'bg-blue-600 text-white'
316- : 'bg-dark-800 text-gray-300 hover:bg-dark-700'
317- } `}
318- >
319- { opt . label }
320- </ button >
321- ) ) }
307+ { difficultyOptions . map ( ( opt ) => {
308+ const active = difficulty === opt . value ;
309+ const colorMap : Record < string , string > = {
310+ easy : active ? 'bg-green-600 text-white' : 'text-green-500 border-green-500/30 bg-green-500/5 hover:bg-green-500/15' ,
311+ medium : active ? 'bg-yellow-600 text-white' : 'text-yellow-500 border-yellow-500/30 bg-yellow-500/5 hover:bg-yellow-500/15' ,
312+ hard : active ? 'bg-red-600 text-white' : 'text-red-500 border-red-500/30 bg-red-500/5 hover:bg-red-500/15' ,
313+ } ;
314+ return (
315+ < button
316+ key = { opt . value }
317+ onClick = { ( ) =>
318+ updateParams ( { difficulty : opt . value , page : '' } )
319+ }
320+ className = { `px-3 py-1.5 rounded-md text-sm transition-colors ${
321+ active && ! [ 'easy' , 'medium' , 'hard' ] . includes ( opt . value )
322+ ? 'bg-blue-600 text-white'
323+ : ''
324+ } ${
325+ active ? '' : ( ! opt . value ? 'bg-dark-800 text-gray-300 hover:bg-dark-700' : 'border' )
326+ } ${ opt . value && colorMap [ opt . value ] ? colorMap [ opt . value ] : '' } `}
327+ >
328+ { opt . label }
329+ </ button >
330+ ) ;
331+ } ) }
322332 </ div >
323333
324334 < button
0 commit comments