wix-style-react
Version:
wix-style-react
49 lines (44 loc) • 1.91 kB
JavaScript
import React from 'react';
import { storySettings } from './storySettings';
import GoogleAddressInput from '../../src/GoogleAddressInput';
import clients from '../../src/clients';
import GoogleAPILoader from '../utils/Components/GoogleAPILoader';
import LiveCodeExample from '../utils/Components/LiveCodeExample';
var InFormExample = '\nclass ExampleWithFormField extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n value: \'\',\n }\n }\n\n render() {\n return (\n <FormField label="GoogleAddressInput component">\n <GoogleAddressInput\n value={this.state.value}\n onChange={e => this.setState({value: e.target.value})}\n onSet={e => this.setState({value: e.originValue})}\n Client={clients.GoogleMapsClient}\n />\n </FormField>\n )\n }\n}\nrender(<ExampleWithFormField/>);\n';
export default {
category: storySettings.kind,
storyName: storySettings.storyName,
component: GoogleAddressInput,
componentPath: '../../src/GoogleAddressInput/GoogleAddressInput.js',
componentWrapper: function componentWrapper(_ref) {
var component = _ref.component;
return React.createElement(
GoogleAPILoader,
null,
component
);
},
componentProps: function componentProps(setProps) {
return {
dataHook: storySettings.dataHook,
Client: clients.GoogleMapsClient,
value: '',
onChange: function onChange(e) {
return setProps({ value: e.target.value });
},
onSet: function onSet(e) {
return setProps({ value: e.originValue });
},
placeholder: 'Enter Address...'
};
},
examples: React.createElement(
GoogleAPILoader,
null,
React.createElement(LiveCodeExample, {
title: 'Usage in forms (with FormField)',
initialCode: InFormExample,
autoRender: false
})
)
};