|
1 | 1 | import React from 'react';
|
2 | 2 | import PropTypes from 'prop-types';
|
3 | 3 |
|
4 |
| -import { Form as CarbonForm } from 'carbon-components-react'; |
| 4 | +import { Form as CarbonForm, Button as CarbonButton, ButtonSet } from 'carbon-components-react'; |
5 | 5 |
|
6 | 6 | import FormTemplate from '@data-driven-forms/common/src/form-template';
|
7 | 7 |
|
8 |
| -export const Button = ({ label, buttonType, ...props }) => <button {...props}>{label}</button>; |
| 8 | +export const Button = ({ label, buttonType, ...props }) => ( |
| 9 | + <CarbonButton kind={buttonType === 'submit' ? 'primary' : 'secondary'} {...props}> |
| 10 | + {label} |
| 11 | + </CarbonButton> |
| 12 | +); |
9 | 13 |
|
10 | 14 | Button.propTypes = {
|
11 | 15 | label: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
12 | 16 | buttonType: PropTypes.string
|
13 | 17 | };
|
14 | 18 |
|
15 |
| -export const ButtonGroup = ({ children, ...props }) => <div {...props}>{children}</div>; |
| 19 | +export const ButtonGroup = ({ children, ...props }) => <ButtonSet {...props}>{children}</ButtonSet>; |
16 | 20 |
|
17 | 21 | ButtonGroup.propTypes = {
|
18 | 22 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
|
@@ -41,7 +45,15 @@ Form.propTypes = {
|
41 | 45 | };
|
42 | 46 |
|
43 | 47 | const WrappedFormTemplate = (props) => (
|
44 |
| - <FormTemplate FormWrapper={Form} Button={Button} ButtonGroup={ButtonGroup} Title={Title} Description={Description} {...props} /> |
| 48 | + <FormTemplate |
| 49 | + FormWrapper={Form} |
| 50 | + Button={Button} |
| 51 | + ButtonGroup={ButtonGroup} |
| 52 | + Title={Title} |
| 53 | + Description={Description} |
| 54 | + buttonOrder={['cancel', 'reset', 'submit']} |
| 55 | + {...props} |
| 56 | + /> |
45 | 57 | );
|
46 | 58 |
|
47 | 59 | export default WrappedFormTemplate;
|
0 commit comments