1234567891011121314151617181920212223242526272829303132333435 |
- import CompactSelect from 'sentry/components/forms/compactSelect';
- type DropdownItemProps = Omit<
- React.ComponentProps<typeof CompactSelect>['options'][0],
- 'value'
- >;
- type Props = {
- label: string;
- onSelect: (key: string) => void;
- options: Record<string, DropdownItemProps>;
- selected: string;
- };
- const ReleasesDropdown = ({label: prefix, options, selected, onSelect}: Props) => {
- const mappedOptions = Object.entries(options).map(
- ([key, {label, tooltip, disabled}]) => ({
- value: key,
- label,
- tooltip,
- disabled,
- })
- );
- return (
- <CompactSelect
- options={mappedOptions}
- onChange={opt => onSelect(opt.value)}
- value={selected}
- triggerProps={{prefix, style: {width: '100%'}}}
- />
- );
- };
- export default ReleasesDropdown;
|