| 1 |
import React, { Fragment } from 'react'; |
| 2 |
import { connectionStatus } from '../../constants/leadinConfig'; |
| 3 |
import ConnectPluginBanner from '../Common/ConnectPluginBanner'; |
| 4 |
import ElementorFormSelect from './ElementorFormSelect'; |
| 5 |
import { IFormAttributes } from './registerFormWidget'; |
| 6 |
|
| 7 |
const ConnectionStatus = { |
| 8 |
Connected: 'Connected', |
| 9 |
NotConnected: 'NotConnected', |
| 10 |
}; |
| 11 |
|
| 12 |
export default function FormControlController( |
| 13 |
attributes: IFormAttributes, |
| 14 |
setValue: Function |
| 15 |
) { |
| 16 |
return () => { |
| 17 |
const render = () => { |
| 18 |
if (connectionStatus === ConnectionStatus.Connected) { |
| 19 |
return ( |
| 20 |
<ElementorFormSelect |
| 21 |
formId={attributes.formId} |
| 22 |
setAttributes={setValue} |
| 23 |
/> |
| 24 |
); |
| 25 |
} else { |
| 26 |
return <ConnectPluginBanner />; |
| 27 |
} |
| 28 |
}; |
| 29 |
return <Fragment>{render()}</Fragment>; |
| 30 |
}; |
| 31 |
} |
| 32 |
|