| 1 |
import { memo } from "@wordpress/element"; |
| 2 |
import { FocalPointPicker } from "@wordpress/components"; |
| 3 |
import "./editor.scss"; |
| 4 |
import { priceLink } from "../../blocks/shared/helpFn"; |
| 5 |
|
| 6 |
const SPFocalPointPicker = ({ label = "Focal Point", url = "", attributes, attributesKey, setAttributes, pro = false }) => { |
| 7 |
const focalPointHandler = (newValue) => { |
| 8 |
setAttributes({ [attributesKey]: newValue }); |
| 9 |
}; |
| 10 |
return ( |
| 11 |
<> |
| 12 |
<div className={`sp-smart-post-focal-point sp-smart-post-component-mb${pro ? " sp-is-pro" : ""}`}> |
| 13 |
<div className="sp-smart-post-header-control"> |
| 14 |
<div className="sp-smart-post-header-control-left"> |
| 15 |
<span className="sp-smart-post-component-title"> |
| 16 |
{label} |
| 17 |
{pro && <a target="_blank" href={priceLink} className="sp-smart-pro-text">(Pro)</a>} |
| 18 |
</span> |
| 19 |
</div> |
| 20 |
</div> |
| 21 |
<div className="sp-smart-post-focal-point-control"> |
| 22 |
<FocalPointPicker |
| 23 |
__nextHasNoMarginBottom |
| 24 |
url={url} |
| 25 |
value={attributes} |
| 26 |
onChange={focalPointHandler} |
| 27 |
/> |
| 28 |
</div> |
| 29 |
</div> |
| 30 |
</> |
| 31 |
); |
| 32 |
}; |
| 33 |
|
| 34 |
export default memo(SPFocalPointPicker); |
| 35 |
|