import React from 'react'; import 'codemirror/theme/duotone-light.css'; import SelectSearch, { fuzzySearch } from 'react-select-search'; import { CodeHinter } from '../../CodeBuilder/CodeHinter'; class Airtable extends React.Component { constructor(props) { super(props); this.state = { options: this.props.options }; } componentDidMount() { this.setState({ options: this.props.options }); } changeOption = (option, value) => { this.setState( { options: { ...this.state.options, [option]: value } }, () => { this.props.optionsChanged(this.state.options); } ); }; changeOperation = (operation) => { this.setState( { options: { ...this.state.options, operation } }, () => { this.props.optionsChanged(this.state.options); } ); }; render() { const { options } = this.state; return (
{options && (
{ this.changeOperation(value); }} filterOptions={fuzzySearch} placeholder="Select.." />
{(['list_records'].includes(this.state.options.operation)) && (
this.changeOption('base_id', value)} />
this.changeOption('table_name', value)} />
this.changeOption('page_size', value)} />
this.changeOption('offset', value)} />
)}
)}
); } } export { Airtable };