mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 14:59:41 +02:00
refactor(docker/containers): migrate commands tab to react [EE-5208] (#10085)
This commit is contained in:
parent
46e73ee524
commit
f7366d9788
42 changed files with 1783 additions and 951 deletions
|
@ -0,0 +1,48 @@
|
|||
import clsx from 'clsx';
|
||||
|
||||
import { Button } from '@@/buttons';
|
||||
import { InputGroup } from '@@/form-components/InputGroup';
|
||||
|
||||
export function OverridableInput({
|
||||
value,
|
||||
onChange,
|
||||
id,
|
||||
placeholder,
|
||||
}: {
|
||||
value: string | null;
|
||||
onChange: (value: string | null) => void;
|
||||
id: string;
|
||||
placeholder: string;
|
||||
}) {
|
||||
const override = value !== null;
|
||||
|
||||
return (
|
||||
<InputGroup>
|
||||
<InputGroup.ButtonWrapper>
|
||||
<Button
|
||||
color="light"
|
||||
size="medium"
|
||||
className={clsx('!ml-0', { active: !override })}
|
||||
onClick={() => onChange(null)}
|
||||
>
|
||||
Default
|
||||
</Button>
|
||||
<Button
|
||||
color="light"
|
||||
size="medium"
|
||||
className={clsx({ active: override })}
|
||||
onClick={() => onChange('')}
|
||||
>
|
||||
Override
|
||||
</Button>
|
||||
</InputGroup.ButtonWrapper>
|
||||
<InputGroup.Input
|
||||
disabled={!override}
|
||||
value={value || ''}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
id={id}
|
||||
placeholder={placeholder}
|
||||
/>
|
||||
</InputGroup>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue