Added formrow components and for fields changed components + reformatted couple of job detail screens. BOD-160 BOD-155

This commit is contained in:
Patrick Fic
2020-06-11 10:17:53 -07:00
parent cec3fec481
commit 886c7e9cb9
20 changed files with 405 additions and 174 deletions

View File

@@ -0,0 +1,39 @@
import React from "react";
import { Row, Col, Typography } from "antd";
export default function LayoutFormRow({ header, children }) {
if (!!!children.length) {
//We have only one element. It's going to get the whole thing.
return children;
}
const rowGutter = { gutter: [32, 32] };
const colSpan = (maxspan) => {
console.log("maxspan", maxspan);
return {
xs: {
span: 24,
},
md: {
span: !!maxspan ? Math.min(12, maxspan) : 12,
},
lg: {
span: !!maxspan
? Math.min(Math.max(24 / children.length, 6), maxspan)
: Math.max(24 / children.length, 6),
},
};
};
return (
<div>
{header ? <Typography.Title level={4}>{header}</Typography.Title> : null}
<Row {...rowGutter}>
{children.map((c, idx) => (
<Col key={idx} {...colSpan(c.props && c.props.maxspan)}>
{c}
</Col>
))}
</Row>
</div>
);
}