Hide checkbox on other placement
[MAILPOET-2873]
This commit is contained in:
@@ -8,6 +8,7 @@ type Props = {
|
|||||||
label: string,
|
label: string,
|
||||||
icon: JSX.Element,
|
icon: JSX.Element,
|
||||||
active: boolean,
|
active: boolean,
|
||||||
|
canBeActive?: boolean,
|
||||||
onClick: () => void,
|
onClick: () => void,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ const FormPlacementOption = ({
|
|||||||
label,
|
label,
|
||||||
icon,
|
icon,
|
||||||
active,
|
active,
|
||||||
|
canBeActive,
|
||||||
onClick,
|
onClick,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const [hover, setHover] = useState(false);
|
const [hover, setHover] = useState(false);
|
||||||
@@ -25,7 +27,7 @@ const FormPlacementOption = ({
|
|||||||
className={
|
className={
|
||||||
classnames(
|
classnames(
|
||||||
'form-placement-option',
|
'form-placement-option',
|
||||||
{ 'form-placement-option-active': active }
|
{ 'form-placement-option-active': active && canBeActive }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
onMouseEnter={() => setHover(true)}
|
onMouseEnter={() => setHover(true)}
|
||||||
@@ -54,11 +56,11 @@ const FormPlacementOption = ({
|
|||||||
{SettingsIcon}
|
{SettingsIcon}
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
hover && !active
|
hover && !active && canBeActive
|
||||||
&& <div className="form-placement-settings-oval" />
|
&& <div className="form-placement-settings-oval" />
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
active
|
active && canBeActive
|
||||||
&& (
|
&& (
|
||||||
<div className="form-placement-settings-check">
|
<div className="form-placement-settings-check">
|
||||||
{CheckIcon}
|
{CheckIcon}
|
||||||
@@ -81,4 +83,8 @@ const FormPlacementOption = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FormPlacementOption.defaultProps = {
|
||||||
|
canBeActive: true,
|
||||||
|
};
|
||||||
|
|
||||||
export default FormPlacementOption;
|
export default FormPlacementOption;
|
||||||
|
@@ -9,6 +9,7 @@ type Props = {
|
|||||||
children: React.ReactNode,
|
children: React.ReactNode,
|
||||||
onSave: () => void,
|
onSave: () => void,
|
||||||
active: boolean,
|
active: boolean,
|
||||||
|
canBeActive?: boolean,
|
||||||
label: string,
|
label: string,
|
||||||
header?: string,
|
header?: string,
|
||||||
description?: string,
|
description?: string,
|
||||||
@@ -20,6 +21,7 @@ const BelowPages = ({
|
|||||||
label,
|
label,
|
||||||
header,
|
header,
|
||||||
active,
|
active,
|
||||||
|
canBeActive,
|
||||||
onSave,
|
onSave,
|
||||||
children,
|
children,
|
||||||
icon,
|
icon,
|
||||||
@@ -37,6 +39,7 @@ const BelowPages = ({
|
|||||||
label={label}
|
label={label}
|
||||||
icon={icon}
|
icon={icon}
|
||||||
active={active}
|
active={active}
|
||||||
|
canBeActive={canBeActive}
|
||||||
onClick={() => setDisplaySettings(true)}
|
onClick={() => setDisplaySettings(true)}
|
||||||
/>
|
/>
|
||||||
{
|
{
|
||||||
@@ -70,4 +73,8 @@ const BelowPages = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BelowPages.defaultProps = {
|
||||||
|
canBeActive: true,
|
||||||
|
};
|
||||||
|
|
||||||
export default BelowPages;
|
export default BelowPages;
|
||||||
|
@@ -73,6 +73,7 @@ const Popup = () => {
|
|||||||
header={MailPoet.I18n.t('formPlacementOther')}
|
header={MailPoet.I18n.t('formPlacementOther')}
|
||||||
label={MailPoet.I18n.t('formPlacementOtherLabel')}
|
label={MailPoet.I18n.t('formPlacementOtherLabel')}
|
||||||
icon={Icon}
|
icon={Icon}
|
||||||
|
canBeActive={false}
|
||||||
>
|
>
|
||||||
<p>{addFormWidgetHint}</p>
|
<p>{addFormWidgetHint}</p>
|
||||||
<p>{addFormShortcodeHint}</p>
|
<p>{addFormShortcodeHint}</p>
|
||||||
|
Reference in New Issue
Block a user