File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323 Sparkles ,
2424 Tag ,
2525 Info ,
26+ X ,
2627} from 'lucide-react' ;
2728
2829const NewsPage : React . FC = ( ) => {
@@ -303,8 +304,24 @@ const NewsPage: React.FC = () => {
303304 : '' ;
304305 navigate ( `/news/${ catPath } ${ query } ` , { replace : true } ) ;
305306 } }
306- className = "w-full pl-10 pr-4 py-3 border border-gray-200 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-300"
307+ className = "w-full pl-10 pr-10 py-3 border border-gray-200 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-300"
307308 />
309+ { searchTerm && (
310+ < button
311+ onClick = { ( ) => {
312+ setSearchTerm ( '' ) ;
313+ const catPath =
314+ activeCategory === 'All'
315+ ? 'all'
316+ : activeCategory . toLowerCase ( ) . replace ( / \s + / g, '-' ) ;
317+ navigate ( `/news/${ catPath } ` , { replace : true } ) ;
318+ } }
319+ className = "absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors"
320+ aria-label = "Clear search"
321+ >
322+ < X size = { 20 } />
323+ </ button >
324+ ) }
308325 </ div >
309326 </ div >
310327
You can’t perform that action at this time.
0 commit comments