Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/components/Field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const Field = ({
disabled = false,
formHasErrors = false,
id,
labelsAsPlaceholders,
}) => {
const intl = useIntl();

Expand All @@ -56,21 +57,24 @@ const Field = ({
<TextWidget
id={name}
name={name}
title={label}
title={labelsAsPlaceholders ? '' : label}
placeholder={labelsAsPlaceholders ? label : ''}
description={description}
required={required}
onChange={onChange}
value={value}
isDisabled={disabled}
invalid={isInvalid().toString()}
columns={labelsAsPlaceholders ? 1 : undefined}
{...(isInvalid() ? { className: 'is-invalid' } : {})}
/>
)}
{field_type === 'textarea' && (
<TextareaWidget
id={name}
name={name}
title={label}
title={labelsAsPlaceholders ? '' : label}
placeholder={labelsAsPlaceholders ? label : ''}
description={description}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not 'columns' prop here too?

required={required}
onChange={onChange}
Expand All @@ -85,7 +89,7 @@ const Field = ({
<SelectWidget
id={name}
name={name}
title={label}
title={labelsAsPlaceholders ? '' : label}
description={description}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not 'columns' prop here too?

getVocabulary={() => {}}
getVocabularyTokenTitle={() => {}}
Expand Down Expand Up @@ -184,7 +188,8 @@ const Field = ({
<EmailWidget
id={name}
name={name}
title={label}
title={labelsAsPlaceholders ? '' : label}
placeholder={labelsAsPlaceholders ? label : ''}
description={description}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not 'columns' prop here too?

required={required}
onChange={onChange}
Expand Down
2 changes: 2 additions & 0 deletions src/components/FormView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const FormView = ({
disabled
valid
formHasErrors={formErrors?.length > 0}
labelsAsPlaceholders={data.labelsAsPlaceholders}
/>
</Grid.Column>
</Grid.Row>
Expand Down Expand Up @@ -148,6 +149,7 @@ const FormView = ({
}
valid={isValidField(name)}
formHasErrors={formErrors?.length > 0}
labelsAsPlaceholders={data.labelsAsPlaceholders}
/>
</Grid.Column>
</Grid.Row>
Expand Down
5 changes: 5 additions & 0 deletions src/formSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default () => {
'captcha',
'store',
'send',
'labelsAsPlaceholders',
],
},
],
Expand Down Expand Up @@ -107,6 +108,10 @@ export default () => {
type: 'boolean',
title: intl.formatMessage(messages.send),
},
labelsAsPlaceholders: {
type: 'boolean',
title: 'Use labels as placeholders',
},
},
required: ['default_to', 'default_from', 'default_subject'],
};
Expand Down