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:
parent
9223c0226a
commit
df381b6a33
8 changed files with 236 additions and 42 deletions
|
@ -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)}
|
||||
/>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue