Added formrow components and for fields changed components + reformatted couple of job detail screens. BOD-160 BOD-155
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user