Portal/rsconcept/frontend/src/features/oss/components/select-block.tsx

29 lines
743 B
TypeScript
Raw Normal View History

2025-04-21 20:35:40 +03:00
import { ComboBox } from '@/components/input/combo-box';
import { type Styling } from '@/components/props';
import { type IBlock } from '../models/oss';
interface SelectBlockProps extends Styling {
id?: string;
value: IBlock | null;
onChange: (newValue: IBlock | null) => void;
items?: IBlock[];
placeholder?: string;
noBorder?: boolean;
popoverClassname?: string;
}
export function SelectBlock({ items, placeholder = 'Выберите блок', ...restProps }: SelectBlockProps) {
return (
<ComboBox
items={items}
placeholder={placeholder}
idFunc={block => String(block.id)}
labelValueFunc={block => block.title}
labelOptionFunc={block => block.title}
{...restProps}
/>
);
}