'use client'; import clsx from 'clsx'; import { MiniButton } from '@/components/control'; import { Dropdown, useDropdown } from '@/components/dropdown'; import { IconFolderTree } from '@/components/icons'; import { type Styling } from '@/components/props'; import { prefixes } from '@/utils/constants'; import { SelectLocation } from '../select-location'; interface SelectLocationContextProps extends Styling { value: string; onChange: (newValue: string) => void; title?: string; dropdownHeight?: string; } export function SelectLocationContext({ value, title = 'Проводник...', onChange, className, dropdownHeight = 'h-50', ...restProps }: SelectLocationContextProps) { const menu = useDropdown(); function handleClick(event: React.MouseEvent, newValue: string) { event.preventDefault(); event.stopPropagation(); menu.hide(); onChange(newValue); } return (
} onClick={() => menu.toggle()} /> handleClick(event, target.getPath())} />
); }