Skip to content

Commit 8c74ccc

Browse files
committed
ui: forms - required '*' position when no title
Signed-off-by: Pamfilos Fokianos <pamfilosf@gmail.com>
1 parent 92bb1e8 commit 8c74ccc

File tree

1 file changed

+9
-4
lines changed
  • ui/cap-react/src/components/drafts/form/themes/grommet/templates

1 file changed

+9
-4
lines changed

ui/cap-react/src/components/drafts/form/themes/grommet/templates/FieldTemplate.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Box from "grommet/components/Box";
66
import FieldHeader from "../../grommet-preview/components/FieldHeader";
77
import { Paragraph } from "grommet";
88

9-
let FieldTemplate = function(props) {
9+
let FieldTemplate = function (props) {
1010
const { id, label, rawDescription, children, uiSchema, required } = props;
1111

1212
let gridColumns = null;
@@ -37,7 +37,7 @@ let FieldTemplate = function(props) {
3737
}}
3838
flex={
3939
props.uiSchema["ui:object"] &&
40-
props.uiSchema["ui:object"] === "tabView"
40+
props.uiSchema["ui:object"] === "tabView"
4141
? true
4242
: null
4343
}
@@ -64,9 +64,14 @@ let FieldTemplate = function(props) {
6464
style={{ color: "#000" }}
6565
dangerouslySetInnerHTML={{ __html: label }}
6666
/>
67-
{ required && <strong style={{padding: "0 3px"}}>*</strong> }
67+
{required && (
68+
label ? <strong style={{ padding: "0 3px" }}>*</strong> :
69+
<div style={{position: 'absolute', marginLeft: '10px', left: 0}}>
70+
<div><strong>*</strong></div>
71+
</div>
72+
)}
6873
{rawDescription ? (
69-
<span dangerouslySetInnerHTML={{ __html: rawDescription }} />
74+
<span style={{marginLeft: '10px'}} dangerouslySetInnerHTML={{ __html: rawDescription }} />
7075
) : null}
7176
</span>
7277
}

0 commit comments

Comments
 (0)