-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCostCalculatorWithReplaceableComponents.tsx
More file actions
55 lines (52 loc) · 1.56 KB
/
CostCalculatorWithReplaceableComponents.tsx
File metadata and controls
55 lines (52 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import {
CostCalculatorFlow,
CostCalculatorForm,
CostCalculatorSubmitButton,
CostCalculatorResetButton,
} from '@remoteoss/remote-flows';
import { components } from './Components';
import { RemoteFlows } from './RemoteFlows';
import './css/main.css';
const estimationOptions = {
title: 'Estimate for a new company',
includeBenefits: true,
includeCostBreakdowns: true,
};
export const CostCalculatorWithReplaceableComponents = () => {
const onReset = () => {
console.log('Reset button clicked');
// Add your reset logic here
};
return (
<RemoteFlows isClientToken components={components}>
<CostCalculatorFlow
estimationOptions={estimationOptions}
render={(props) => {
if (props.isLoading) {
return <div>Loading...</div>;
}
return (
<div>
<CostCalculatorForm
onSubmit={(payload) => console.log(payload)}
onError={(error) => console.error({ error })}
onSuccess={(response) => console.log({ response })}
/>
<div className='buttons-container'>
<CostCalculatorResetButton
className='reset-button'
onClick={onReset}
>
Reset
</CostCalculatorResetButton>
<CostCalculatorSubmitButton className='submit-button'>
Get estimate
</CostCalculatorSubmitButton>
</div>
</div>
);
}}
/>
</RemoteFlows>
);
};