Mark mandatory fields

[MAILPOET-2451]
This commit is contained in:
Pavel Dohnal
2019-12-04 13:53:48 +01:00
committed by Rostislav Wolný
parent 639ee8b70d
commit 1f5666ccd1
2 changed files with 18 additions and 4 deletions

View File

@@ -47,13 +47,20 @@ const FirstNameEdit = ({ attributes, setAttributes }) => {
/>
);
const getLabel = () => {
if (attributes.mandatory) {
return `${attributes.label} *`;
}
return attributes.label;
};
return (
<>
{inspectorControls}
{attributes.labelWithinInput ? (getTextInput(attributes.label)
{attributes.labelWithinInput ? (getTextInput(getLabel())
) : (
<label className="mailpoet_text_label" data-automation-id="editor_first_name_label" htmlFor="first_name">
{attributes.label}
{getLabel()}
<br />
{getTextInput('')}
</label>

View File

@@ -47,13 +47,20 @@ const LastNameEdit = ({ attributes, setAttributes }) => {
/>
);
const getLabel = () => {
if (attributes.mandatory) {
return `${attributes.label} *`;
}
return attributes.label;
};
return (
<>
{inspectorControls}
{attributes.labelWithinInput ? (getTextInput(attributes.label)
{attributes.labelWithinInput ? (getTextInput(getLabel())
) : (
<label className="mailpoet_text_label" data-automation-id="editor_last_name_label" htmlFor="last_name">
{attributes.label}
{getLabel()}
<br />
{getTextInput('')}
</label>