Skip to content

Commit

Permalink
[PR feedback] Tweak delimited playground to pass invalid/disabled/rea…
Browse files Browse the repository at this point in the history
…donly states to start/end controls
  • Loading branch information
cee-chen committed Aug 13, 2024
1 parent 7424d0d commit 78c1c29
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import React, { FunctionComponent } from 'react';
import React, { FunctionComponent, cloneElement } from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import {
hideStorybookControls,
Expand Down Expand Up @@ -116,6 +116,17 @@ export const Playground: Story = {
/>
),
},
render: ({ startControl, endControl, ...args }) => {
const { isInvalid, isDisabled, readOnly } = args;
const clonedControlProps = { isInvalid, disabled: isDisabled, readOnly };
return (
<EuiFormControlLayoutDelimited
{...args}
startControl={cloneElement(startControl, clonedControlProps)}
endControl={cloneElement(endControl, clonedControlProps)}
/>
);
},
};

export const KitchenSink: Story = {
Expand Down

0 comments on commit 78c1c29

Please sign in to comment.