'use client'; import clsx from 'clsx'; import { SelectorButton } from '@/components/Control'; import { LocationIcon } from '@/components/DomainIcons'; import { Dropdown, DropdownButton, useDropdown } from '@/components/Dropdown'; import { CProps } from '@/components/props'; import { prefixes } from '@/utils/constants'; import { describeLocationHead, labelLocationHead } from '@/utils/labels'; import { LocationHead } from '../models/library'; interface SelectLocationHeadProps extends CProps.Styling { value: LocationHead; onChange: (newValue: LocationHead) => void; excluded?: LocationHead[]; } function SelectLocationHead({ value, excluded = [], onChange, className, ...restProps }: SelectLocationHeadProps) { const menu = useDropdown(); function handleChange(newValue: LocationHead) { menu.hide(); onChange(newValue); } return (
} text={labelLocationHead(value)} onClick={menu.toggle} /> {Object.values(LocationHead) .filter(head => !excluded.includes(head)) .map((head, index) => { return ( handleChange(head)} title={describeLocationHead(head)} >
{labelLocationHead(head)}
); })}
); } export default SelectLocationHead;