@@ -13,6 +13,21 @@ import Stopwatch from './Stopwatch'; // Import Stopwatch
1313import { filterItems } from '../utils/search' ;
1414import { TerminalWindowIcon } from "@phosphor-icons/react" ; // Import the search utility
1515
16+ const categoryColorMap = {
17+ 'command' : 'bg-indigo-400' ,
18+ 'page' : 'bg-fuchsia-400' ,
19+ 'post' : 'bg-blue-400' ,
20+ 'project' : 'bg-orange-400' ,
21+ 'log' : 'bg-rose-400' ,
22+ 'app' : 'bg-cyan-400' ,
23+ 'story' : 'bg-violet-400' ,
24+ 'notebook' : 'bg-lime-400' ,
25+ } ;
26+
27+ const getCategoryColorClass = ( type ) => {
28+ return categoryColorMap [ type ] || 'bg-gray-500' ; // Default gray for unmapped types
29+ } ;
30+
1631const CommandPalette = ( { isOpen, setIsOpen, openGenericModal, toggleDigitalRain } ) => {
1732 const [ searchTerm , setSearchTerm ] = useState ( '' ) ;
1833 const [ selectedIndex , setSelectedIndex ] = useState ( 0 ) ;
@@ -269,7 +284,7 @@ const CommandPalette = ({ isOpen, setIsOpen, openGenericModal, toggleDigitalRain
269284 ref = { inputRef }
270285 type = "text"
271286 placeholder = { isLoading ? "Loading data..." : "Search or type a command..." }
272- className = "w-full bg-transparent text-lg placeholder-gray-500 focus:outline-none"
287+ className = "w-full bg-transparent text-lg placeholder-gray-500 focus:outline-none font-mono "
273288 value = { searchTerm }
274289 onChange = { e => setSearchTerm ( e . target . value ) }
275290 disabled = { isLoading }
@@ -280,14 +295,14 @@ const CommandPalette = ({ isOpen, setIsOpen, openGenericModal, toggleDigitalRain
280295 filteredItems . map ( ( item , index ) => (
281296 < div
282297 key = { `${ item . type } -${ item . slug || item . commandId } -${ index } ` }
283- className = { `p-3 rounded-lg cursor-pointer flex justify-between items-center ${
298+ className = { `p-3 rounded-lg cursor-pointer flex justify-between items-center font-mono ${
284299 selectedIndex === index ? 'bg-gray-200 dark:bg-gray-700' : 'hover:bg-gray-200 dark:hover:bg-gray-700'
285300 } `}
286301 onClick = { ( ) => handleItemClick ( item ) }
287302 onMouseMove = { ( ) => setSelectedIndex ( index ) }
288303 >
289304 < span > { item . title } </ span >
290- < span className = " text-xs uppercase bg -gray-300 dark:bg-gray-600 px-2 py-1 rounded" > { item . type } </ span >
305+ < span className = { ` text-xs uppercase text -gray-800 font-bold ${ getCategoryColorClass ( item . type ) } px-2 py-1 rounded` } > { item . type } </ span >
291306 </ div >
292307 ) )
293308 ) : (
0 commit comments