Files
supabase/packages/ui-patterns/Cmdk/ChildItem.tsx
Jonathan Summers-Muir 07a6c5ab4e Chore/move cmdk (#21936)
* init

* fix build issues

* move deps over

* Update CommandMenuWrapper.tsx

* build fixes

* Update sitemap_www.xml

* reset

* Update sitemap_www.xml

* Update tsconfig.json

* Update package.json

* Update package.json

* Update package-lock.json

* Update package.json
2024-03-11 18:31:23 +08:00

12 lines
480 B
TypeScript

import { useCommandState } from 'cmdk'
import { CommandItem } from './Command.utils'
import React from 'react'
export default function ChildItem({ children, isSubItem, ...props }: any) {
const search = useCommandState((state) => state.search)
// if search is empty & items is marked as a subItem, don't show it
// ie: only show these items in search results, not top level
if (!search && isSubItem) return null
return <CommandItem {...props}>{children}</CommandItem>
}