mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-18 20:09:08 +02:00
87414c1c9c
* fix: add sidebar button * fix: set absolute positioned sidebar button * feat: test setup * fix: add tests for adding strategy * fix: add delete strategy test * feat: add workflow * feat: add vercel token * fix: update project id * fix: increase sleep * fix: sleep * fix: vercel * fix: typo * fix: vercel preview url action * fix: yml formatting * fix: steps * fix: format * fix: runs on * fix: team id * fix: teamid * fix: add workflow * fix: remove unused import * fix: add token * fix: add configuration * fix: set env variables * fix: use with * feat: main navigation routes * feat: mobile views * fix: change spec name * fix: update cypress project id * fix: add record key * fix: button positioning * feat: permissions * fix: custom strategy * fix: remove unused action yml * fix: update yarn lock * fix: keys * fix: remove videos and screenshots * fix: add cyrpess folders to gitignore * fix: env variable
72 lines
1.7 KiB
TypeScript
72 lines
1.7 KiB
TypeScript
import React from 'react';
|
|
import { FormControl, InputLabel, MenuItem, Select } from '@material-ui/core';
|
|
import { SELECT_ITEM_ID } from '../../testIds';
|
|
|
|
export interface ISelectOption {
|
|
key: string;
|
|
title?: string;
|
|
label?: string;
|
|
}
|
|
export interface ISelectMenuProps {
|
|
name: string;
|
|
id: string;
|
|
value?: string;
|
|
label?: string;
|
|
options: ISelectOption[];
|
|
style?: object;
|
|
onChange?: (
|
|
event: React.ChangeEvent<{ name?: string; value: unknown }>,
|
|
child: React.ReactNode
|
|
) => void;
|
|
disabled?: boolean;
|
|
className?: string;
|
|
classes?: any;
|
|
}
|
|
|
|
const SelectMenu: React.FC<ISelectMenuProps> = ({
|
|
name,
|
|
value = '',
|
|
label = '',
|
|
options,
|
|
onChange,
|
|
id,
|
|
disabled = false,
|
|
className,
|
|
classes,
|
|
...rest
|
|
}) => {
|
|
const renderSelectItems = () =>
|
|
options.map(option => (
|
|
<MenuItem
|
|
key={option.key}
|
|
value={option.key}
|
|
title={option.title || ''}
|
|
data-test={`${SELECT_ITEM_ID}-${option.label}`}
|
|
>
|
|
{option.label}
|
|
</MenuItem>
|
|
));
|
|
|
|
return (
|
|
<FormControl variant="outlined" size="small" classes={classes}>
|
|
<InputLabel htmlFor={id} id={id}>
|
|
{label}
|
|
</InputLabel>
|
|
<Select
|
|
name={name}
|
|
disabled={disabled}
|
|
onChange={onChange}
|
|
className={className}
|
|
label={label}
|
|
id={id}
|
|
value={value}
|
|
{...rest}
|
|
>
|
|
{renderSelectItems()}
|
|
</Select>
|
|
</FormControl>
|
|
);
|
|
};
|
|
|
|
export default SelectMenu;
|