Skip to content

Commit dba2b55

Browse files
committed
Fix 2 and 3 col form not rendering properly
1 parent 0fbcb7c commit dba2b55

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

packages/react-sdk-components/src/components/template/DefaultForm/DefaultForm.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@
2323
.psdk-default-form-three-column .grid-column {
2424
grid-column: 1 / span 3;
2525
}
26+
27+
.psdk-default-form-instruction-text{
28+
padding-top: 0.625rem;
29+
padding-bottom: 0.625rem;
30+
}
Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React, { createElement } from "react";
2-
import PropTypes from "prop-types";
1+
import React, { createElement } from 'react';
2+
import PropTypes from 'prop-types';
33

44
import { getInstructions } from '../../helpers/template-utils';
55
import createPConnectComponent from '../../../bridge/react_pconnect';
@@ -13,19 +13,19 @@ export default function DefaultForm(props) {
1313

1414
let divClass: string;
1515

16-
const numCols = NumCols || "1";
16+
const numCols = NumCols || '1';
1717
switch (numCols) {
18-
case "1" :
19-
divClass = "psdk-default-form-one-column";
18+
case '1':
19+
divClass = 'psdk-default-form-one-column';
2020
break;
21-
case "2" :
22-
divClass = "psdk-default-form-two-column";
21+
case '2':
22+
divClass = 'psdk-default-form-two-column';
2323
break;
24-
case "3" :
25-
divClass = "psdk-default-form-three-column";
24+
case '3':
25+
divClass = 'psdk-default-form-three-column';
2626
break;
27-
default :
28-
divClass = "psdk-default-form-one-column";
27+
default:
28+
divClass = 'psdk-default-form-one-column';
2929
break;
3030
}
3131

@@ -35,15 +35,19 @@ export default function DefaultForm(props) {
3535
// to take the children and create components for them, put in an array and pass as the
3636
// defaultForm kids
3737
const arChildren = getPConnect().getChildren()[0].getPConnect().getChildren();
38-
// eslint-disable-next-line react/no-array-index-key
39-
const dfChildren = arChildren.map((kid, idx) => createElement(createPConnectComponent(), {...kid, key: idx}));
38+
const dfChildren = arChildren.map((kid, idx) =>
39+
// eslint-disable-next-line react/no-array-index-key
40+
createElement(createPConnectComponent(), { ...kid, key: idx })
41+
);
4042

4143
return (
42-
<div className={divClass}>
43-
<div>{instructionText}</div>
44-
{dfChildren}
45-
</div>
46-
)
44+
<>
45+
{instructionText && (
46+
<div className='psdk-default-form-instruction-text'>{instructionText}</div>
47+
)}
48+
<div className={divClass}>{dfChildren}</div>
49+
</>
50+
);
4751
}
4852

4953
DefaultForm.propTypes = {
@@ -52,5 +56,5 @@ DefaultForm.propTypes = {
5256
};
5357

5458
DefaultForm.defaultProps = {
55-
NumCols: "1"
59+
NumCols: '1'
5660
};

0 commit comments

Comments
 (0)