/* * Copyright (c) 2018-present, Revolut LTD. * * This source code is licensed under the Apache 2.0 license found in the * LICENSE file in the root directory of this source tree. */ import * as React from 'react' import { boolean, text, withKnobs } from '@storybook/addon-knobs' import styled from 'styled-components' import { TextInput } from '.' import { ExternalLabel } from './styles' const Wrapper = styled.div` width: 300px; ` class Container extends React.Component { state = { value: '', } onChange = ({ target }) => { this.setState({ value: target.value }) } render() { return ( {React.cloneElement( // @ts-ignore this.props.children, { onChange: this.onChange, value: this.state.value, }, )} ) } } export const Base = () => ( ) export const externalLabel = () => ( Bla bla bla I am looooooooooooooooooooooooooooooooooooong label ) export default { title: 'TextInput', component: TextInput, decorators: [withKnobs], }