Section component displaying all shortcuts for a given category.
export const ShortcutCategorySection = ({ category, categoryShortcuts,}: { category: ShortcutCategory; categoryShortcuts: (typeof SHORTCUTS)[0][];}) => { const Icon = categoryIcons[category]; if (categoryShortcuts.length === 0) { return null; } return ( <div className="space-y-3"> <div className="flex items-center gap-2"> <Icon className="h-4 w-4" /> <h3 className="text-foreground text-sm font-semibold">{category}</h3> <Badge variant="secondary" className="ml-auto text-xs"> {categoryShortcuts.length} </Badge> </div> <div className="space-y-2 pl-6"> {categoryShortcuts.map((shortcut) => ( <ShortcutCard key={shortcut.id} shortcutItem={shortcut} /> ))} </div> </div> );}; Copy
export const ShortcutCategorySection = ({ category, categoryShortcuts,}: { category: ShortcutCategory; categoryShortcuts: (typeof SHORTCUTS)[0][];}) => { const Icon = categoryIcons[category]; if (categoryShortcuts.length === 0) { return null; } return ( <div className="space-y-3"> <div className="flex items-center gap-2"> <Icon className="h-4 w-4" /> <h3 className="text-foreground text-sm font-semibold">{category}</h3> <Badge variant="secondary" className="ml-auto text-xs"> {categoryShortcuts.length} </Badge> </div> <div className="space-y-2 pl-6"> {categoryShortcuts.map((shortcut) => ( <ShortcutCard key={shortcut.id} shortcutItem={shortcut} /> ))} </div> </div> );};
Component properties.
The shortcut category to display.
Array of shortcuts in this category.
Category section with shortcut cards or null if no shortcuts.
Section component displaying all shortcuts for a given category.
Source