Mark mandatory fields
[MAILPOET-2451]
This commit is contained in:
committed by
Rostislav Wolný
parent
639ee8b70d
commit
1f5666ccd1
@@ -47,13 +47,20 @@ const FirstNameEdit = ({ attributes, setAttributes }) => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const getLabel = () => {
|
||||||
|
if (attributes.mandatory) {
|
||||||
|
return `${attributes.label} *`;
|
||||||
|
}
|
||||||
|
return attributes.label;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{inspectorControls}
|
{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">
|
<label className="mailpoet_text_label" data-automation-id="editor_first_name_label" htmlFor="first_name">
|
||||||
{attributes.label}
|
{getLabel()}
|
||||||
<br />
|
<br />
|
||||||
{getTextInput('')}
|
{getTextInput('')}
|
||||||
</label>
|
</label>
|
||||||
|
@@ -47,13 +47,20 @@ const LastNameEdit = ({ attributes, setAttributes }) => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const getLabel = () => {
|
||||||
|
if (attributes.mandatory) {
|
||||||
|
return `${attributes.label} *`;
|
||||||
|
}
|
||||||
|
return attributes.label;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{inspectorControls}
|
{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">
|
<label className="mailpoet_text_label" data-automation-id="editor_last_name_label" htmlFor="last_name">
|
||||||
{attributes.label}
|
{getLabel()}
|
||||||
<br />
|
<br />
|
||||||
{getTextInput('')}
|
{getTextInput('')}
|
||||||
</label>
|
</label>
|
||||||
|
Reference in New Issue
Block a user