import { createHigherOrderComponent } from "@wordpress/compose";
import { InspectorControls } from "@wordpress/block-editor";
import { PanelBody, SelectControl, RangeControl, Icon } from
"@wordpress/components";
import { __ } from "@wordpress/i18n";
// Custom hover icon
const hoverIcon = (
);
const withHoverControls = createHigherOrderComponent((BlockEdit) => {
return (props) => {
const { attributes, setAttributes, isSelected } = props;
const {
blynexHoverEffect = "none",
blynexHoverIntensity = 0.5,
blynexHoverScale = 1.05,
blynexHoverDuration = 0.3,
} = attributes;
return (
<>
{isSelected &&
(props.name === "core/cover" || props.name === "core/image") && (
Hover Effects
}
initialOpen={true}
className="blynex-hover-panel"
>
setAttributes({ blynexHoverEffect: value })
}
/>
{blynexHoverEffect !== "none" && (
<>
setAttributes({ blynexHoverIntensity: value })
}
min={0.1}
max={1}
step={0.1}
/>
setAttributes({ blynexHoverDuration: value })
}
min={0.1}
max={1}
step={0.1}
/>
{props.name === "core/cover" && (
setAttributes({ blynexHoverScale: value })
}
min={1}
max={1.5}
step={0.05}
/>
)}
>
)}
)}
>
);
};
}, "withHoverControls");
wp.hooks.addFilter(
"editor.BlockEdit",
"blynex/hover-effect-controls",
withHoverControls
);