Skip to content

Commit

Permalink
[REVERT ME] Added prop toggles to the EuiInlineEditText example for v…
Browse files Browse the repository at this point in the history
…alidation
  • Loading branch information
breehall committed Mar 30, 2023
1 parent 4d0500f commit b72c9ca
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src-docs/src/views/inline_edit/inline_edit_text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
EuiSpacer,
EuiButtonGroup,
EuiInlineEditTextSizes,
EuiCheckbox,
} from '../../../../src';

export default () => {
Expand All @@ -27,6 +28,12 @@ export default () => {
EuiInlineEditTextSizes
>('m');

const [isInvalidChecked, setIsInvalidChecked] = useState(false);
const [isLoadingChecked, setIsLoadingChecked] = useState(false);

const toggleIsInvalid = (e: any) => setIsInvalidChecked(e.target.checked);
const toggleisLoading = (e: any) => setIsLoadingChecked(e.target.checked);

const textSizeOnChange = (optionId: EuiInlineEditTextSizes) => {
setToggleTextButtonSize(optionId);
};
Expand All @@ -42,10 +49,28 @@ export default () => {

<EuiSpacer />

<EuiCheckbox
id="isInvalidCheckbox"
label="Toggle Validation"
checked={isInvalidChecked}
onChange={(e) => toggleIsInvalid(e)}
/>

<EuiCheckbox
id="isLoadingChecbox"
label="Toggle Loading State"
checked={isLoadingChecked}
onChange={(e) => toggleisLoading(e)}
/>

<EuiSpacer />

<EuiInlineEditText
inputAriaLabel="Edit text inline"
defaultValue="Hello World!"
size={toggleTextButtonSize}
isInvalid={isInvalidChecked}
isLoading={isLoadingChecked}
/>
</>
);
Expand Down

0 comments on commit b72c9ca

Please sign in to comment.