1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 21:35:23 +02:00

feat(templates): remove toggle and add sorting for app templates EE-2522 (#6884)

This commit is contained in:
matias-portainer 2022-07-20 16:27:15 -03:00 committed by GitHub
parent 9223c0226a
commit df381b6a33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 236 additions and 42 deletions

View file

@ -0,0 +1,32 @@
import { Select } from '@@/form-components/ReactSelect';
interface Filter {
label?: string;
}
interface Props {
options: string[];
onChange: (value: string | null) => void;
placeholder?: string;
value: string;
}
export function TemplateListDropdown({
options,
onChange,
placeholder,
value,
}: Props) {
const filterOptions: Filter[] = options.map((value) => ({ label: value }));
const filterValue: Filter | null = value ? { label: value } : null;
return (
<Select
placeholder={placeholder}
options={filterOptions}
value={filterValue}
isClearable
onChange={(option) => onChange(option?.label ?? null)}
/>
);
}