import React, { useState } from 'react';
import { action } from '@storybook/addon-actions';
import { SegmentInput } from '.';
import { Icon } from '../Icon/Icon';
const SegmentFrame = ({ children }: any) => (
<>
>
);
export const BasicInput = () => {
const [value, setValue] = useState('some text');
return (
{
setValue(text as string);
action('Segment value changed')(text);
}}
/>
);
};
export default {
title: 'Data Source/Segment/SegmentInput',
component: SegmentInput,
};
export const BasicInputWithPlaceholder = () => {
const [value, setValue] = useState('');
return (
{
setValue(text as string);
action('Segment value changed')(text);
}}
/>
);
};
const InputComponent = ({ initialValue }: any) => {
const [value, setValue] = useState(initialValue);
return (
{
setValue(text as string);
action('Segment value changed')(text);
}}
/>
);
};
export const InputWithAutoFocus = () => {
const [inputComponents, setInputComponents] = useState([]);
return (
{inputComponents.map((InputComponent: any) => (
))}
{
setInputComponents([...inputComponents, InputComponent]);
}}
>
);
};