Skip to content

Commit

Permalink
use EUI components for tutorial params
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimkibana committed Sep 22, 2023
1 parent d52c5a1 commit 2a32d85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,17 @@

import React from 'react';
import PropTypes from 'prop-types';
import { EuiFormRow, EuiFieldNumber } from '@elastic/eui';

export function NumberParameter({ id, label, value, setParameter }) {
const handleChange = (evt) => {
setParameter(id, parseFloat(evt.target.value));
};

return (
<div className="visEditorSidebar__formRow">
<label className="visEditorSidebar__formLabel" htmlFor={id}>
{label}
</label>
<div className="visEditorSidebar__formControl kuiFieldGroupSection--wide">
<input
className="kuiTextInput"
type="number"
value={value}
onChange={handleChange}
id={id}
/>
</div>
</div>
<EuiFormRow label={label}>
<EuiFieldNumber value={value} onChange={handleChange} fullWidth />
</EuiFormRow>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@

import React from 'react';
import PropTypes from 'prop-types';
import { EuiFormRow, EuiFieldText } from '@elastic/eui';

export function StringParameter({ id, label, value, setParameter }) {
const handleChange = (evt) => {
setParameter(id, evt.target.value);
};

return (
<div className="visEditorSidebar__formRow">
<label className="visEditorSidebar__formLabel">{label}</label>
<div className="visEditorSidebar__formControl kuiFieldGroupSection--wide">
<input className="kuiTextInput" type="text" value={value} onChange={handleChange} />
</div>
</div>
<EuiFormRow label={label}>
<EuiFieldText value={value} onChange={handleChange} fullWidth />
</EuiFormRow>
);
}

Expand Down

0 comments on commit 2a32d85

Please sign in to comment.