diff --git a/plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.tsx b/plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.tsx index 7151446f4f..a38f45c505 100644 --- a/plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.tsx +++ b/plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.tsx @@ -21,22 +21,20 @@ import { Box, Checkbox, FormControlLabel, - FormGroup, - makeStyles, - Theme, + TextField, Typography, } from '@material-ui/core'; +import CheckBoxIcon from '@material-ui/icons/CheckBox'; +import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'; +import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; +import { Autocomplete } from '@material-ui/lab'; import { useEntityTypeFilter } from '@backstage/plugin-catalog-react'; import { alertApiRef, useApi } from '@backstage/core-plugin-api'; -const useStyles = makeStyles(theme => ({ - checkbox: { - padding: theme.spacing(1, 1, 1, 2), - }, -})); +const icon = ; +const checkedIcon = ; export const TemplateTypePicker = () => { - const classes = useStyles(); const alertApi = useApi(alertApiRef); const { error, loading, availableTypes, selectedTypes, setSelectedTypes } = useEntityTypeFilter(); @@ -53,32 +51,31 @@ export const TemplateTypePicker = () => { return null; } - function toggleSelection(type: string) { - setSelectedTypes( - selectedTypes.includes(type) - ? selectedTypes.filter(t => t !== type) - : [...selectedTypes, type], - ); - } - return ( Categories - - {availableTypes.map(type => ( + + multiple + aria-label="Categories" + options={availableTypes} + value={selectedTypes} + onChange={(_: object, value: string[]) => setSelectedTypes(value)} + renderOption={(option, { selected }) => ( toggleSelection(type)} - className={classes.checkbox} + icon={icon} + checkedIcon={checkedIcon} + checked={selected} /> } - label={capitalize(type)} - key={type} + label={option} /> - ))} - + )} + size="small" + popupIcon={} + renderInput={params => } + /> ); };