1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00
unleash.unleash/frontend/src/component/playground/Playground/PlaygroundForm/renderOption.tsx
Thomas Heartman fe09ae214f
chore: fix "key" prop issues in front end tests (#8459)
Fixes all warnings about the "key" prop. The majority of the fixes fall
into one of the following categories:

- Extracting "key" props in tables (you're not allowed to just spread
them in)
- Adding "key" props to autocomplete options and chips
- fixing test data that didn't contain ids
2024-10-16 14:57:43 +02:00

26 lines
793 B
TypeScript

import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank';
import CheckBoxIcon from '@mui/icons-material/CheckBox';
import { Checkbox, styled } from '@mui/material';
const SelectOptionCheckbox = styled(Checkbox)(({ theme }) => ({
marginRight: theme.spacing(0.4),
}));
export const renderOption = (
props: object & { key?: string },
option: { label: string },
{ selected }: { selected: boolean },
) => {
const { key, ...rest } = props;
return (
<li key={key} {...rest}>
<SelectOptionCheckbox
icon={<CheckBoxOutlineBlankIcon fontSize='small' />}
checkedIcon={<CheckBoxIcon fontSize='small' />}
checked={selected}
/>
{option.label}
</li>
);
};