Grafana-UI: Fix use of Fragments as children of InlineField (#46326)

This commit is contained in:
Joao Silva
2022-03-15 17:50:29 +00:00
committed by GitHub
parent b8fba41d74
commit 00c93fff8c
3 changed files with 29 additions and 21 deletions

View File

@@ -3,6 +3,7 @@ import { Input } from '../Input/Input';
import { Button } from '../Button';
import { TextArea } from '../TextArea/TextArea';
import { InlineField } from '../Forms/InlineField';
import { InlineFieldRow } from '../Forms/InlineFieldRow';
interface Props {
label: string;
@@ -15,17 +16,19 @@ interface Props {
export const CertificationKey: FC<Props> = ({ hasCert, label, onChange, onClick, placeholder }) => {
return (
<InlineField label={label} labelWidth={14}>
{hasCert ? (
<>
<Input type="text" disabled value="configured" width={24} />
<Button variant="secondary" onClick={onClick} style={{ marginLeft: 4 }}>
Reset
</Button>
</>
) : (
<TextArea rows={7} onChange={onChange} placeholder={placeholder} required />
<InlineFieldRow>
<InlineField label={label} labelWidth={14} disabled={hasCert}>
{hasCert ? (
<Input type="text" value="configured" width={24} />
) : (
<TextArea rows={7} onChange={onChange} placeholder={placeholder} required />
)}
</InlineField>
{hasCert && (
<Button variant="secondary" onClick={onClick} style={{ marginLeft: 4 }}>
Reset
</Button>
)}
</InlineField>
</InlineFieldRow>
);
};