Skip to content

Commit 7cfc529

Browse files
committed
fix: radio button issues resolved
1 parent 6db07aa commit 7cfc529

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

src/fields/ConfiguredField.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const classNames = require('classnames');
1919

2020
// for unit testing only
2121
export const RawConfiguredField = ({
22+
widget,
2223
data,
2324
type,
2425
descriptionText,
@@ -40,6 +41,7 @@ export const RawConfiguredField = ({
4041
const isCustomComponent = type === 'null' || hasCustomComponent;
4142
const classes = fieldStyles();
4243
const FormRoot = isCustomComponent ? FormGroup : FormControl;
44+
const newLabel = widget === 'radio' ? classes.radioLabel : classes.normalLabel
4345
return (
4446
<FormRoot
4547
id={`${htmlid}-formControl`}
@@ -50,7 +52,7 @@ export const RawConfiguredField = ({
5052
LabelComponent && title && !isCustomComponent && (
5153
<LabelComponent
5254
id={`${htmlid}-labelControl`}
53-
className={descriptionText ? classes.customLabel : classes.normalLabel}
55+
className={descriptionText ? classes.customLabel : newLabel}
5456
style={activeCompColor ? { left: 41, top: -8 } : {}}
5557
{...labelComponentProps}
5658
>
@@ -88,6 +90,7 @@ export const RawConfiguredField = ({
8890
<FormHelperText
8991
error={!isEmpty(hasInlineError) || undefined}
9092
id={`${id}-help`}
93+
style={{ marginLeft: 0, marginRight: 0 }}
9194
>
9295
{helpText}
9396
</FormHelperText>

src/fields/Field.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default (props: FieldProps) => {
2323
isCustomComponent,
2424
} = configureComponent({ ...props, htmlid });
2525

26+
const widget = uiSchema['ui:widget'];
2627
const options = uiSchema['ui:options'] || uiSchema['ui:props'];
2728
const descriptionText = uiSchema && uiSchema['ui:description'];
2829
const activeCompColor = uiSchema && uiSchema['ui:activeCompColor'];
@@ -62,6 +63,7 @@ export default (props: FieldProps) => {
6263
isCustomComponent={isCustomComponent}
6364
hasError={validation && validation.length}
6465
hasInlineError={hasInlineError}
66+
widget={widget}
6567
/>
6668
);
6769
};

src/fields/field-styles.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export default makeStyles((theme: Theme) => createStyles({
2626
left: 8,
2727
top: 8,
2828
},
29+
radioLabel: {
30+
left: 1,
31+
top: 8,
32+
},
2933
customLabel: {
3034
'left': 10,
3135
'transform': 'translate(0, 31px) scale(1)',

src/types/ConfiguredField.type.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ReactElement } from 'react';
22

33
export type ConfiguredFieldProps = {
4+
widget: string;
45
data: any;
56
type: string;
67
descriptionText: string;

0 commit comments

Comments
 (0)