1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-28 17:55:15 +02:00
unleash.unleash/frontend/src/component/commandBar/CommandFeatures.tsx

31 lines
841 B
TypeScript

import {
CommandResultGroup,
type CommandResultGroupItem,
} from './RecentlyVisited/CommandResultGroup';
import { useFeatureSearch } from 'hooks/api/getters/useFeatureSearch/useFeatureSearch';
interface ICommandBar {
searchString: string;
}
export const CommandFeatures = ({ searchString }: ICommandBar) => {
const { features = [] } = useFeatureSearch(
{
query: searchString,
limit: '3',
},
{
revalidateOnFocus: false,
},
);
const flags: CommandResultGroupItem[] = features.map((feature) => ({
name: feature.name,
link: `/projects/${feature.project}/features/${feature.name}`,
description: feature.description,
}));
return (
<CommandResultGroup groupName={'Flags'} icon={'flag'} items={flags} />
);
};