Skip to content

Commit fea6689

Browse files
committed
style: command palette
1 parent e1eb11f commit fea6689

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/components/CommandPalette.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ import Stopwatch from './Stopwatch'; // Import Stopwatch
1313
import { filterItems } from '../utils/search';
1414
import {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+
1631
const 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
) : (

src/pages/CommandsPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function CommandsPage() {
6060
backgroundSize: '10px 10px',
6161
}}
6262
></div>
63-
<div className="relative z-10 p-1">
63+
<div className="relative z-10 p-1 font-mono">
6464
<h1 className="text-3xl font-arvo font-normal mb-4 text-app"> Command Palette </h1>
6565
<hr className="border-gray-700 mb-4" />
6666

0 commit comments

Comments
 (0)