Files
supabase/packages/ui-patterns/CommandMenu/internal/CommandSection.tsx
T
Charis 84732ff44c feat: add new command menu to studio (#28432)
Add new command menu to studio. Ports over commands from old menu (with some minor reorganization), then adds:
- Branch switcher
- Project switcher
2024-08-08 16:42:07 -04:00

25 lines
504 B
TypeScript

import { type ICommand } from './Command'
type ICommandSection = {
id: string
name: string
commands: Array<ICommand>
forceMount?: boolean
meta?: any
}
const toSectionId = (str: string) => str.toLowerCase().replace(/\s+/g, '-')
const section$new = (
name: string,
{ forceMount = false, id }: { forceMount?: boolean; id?: string } = {}
): ICommandSection => ({
id: id ?? toSectionId(name),
name,
forceMount,
commands: [],
})
export { section$new }
export type { ICommandSection }