| 1 |
import { memo } from "@wordpress/element"; |
| 2 |
import Responsive from "../responsive/responsive"; |
| 3 |
import { ResetButton, Units } from "../utility"; |
| 4 |
|
| 5 |
const ComponentsTopSection = ({ |
| 6 |
label, |
| 7 |
units = false, |
| 8 |
attributes, |
| 9 |
setAttributes, |
| 10 |
attributesKey = "", |
| 11 |
onReset = false, |
| 12 |
onUnitChange, |
| 13 |
}) => { |
| 14 |
return ( |
| 15 |
<div className="sp-smart-post-header-control sp-mb-8px"> |
| 16 |
<div className="sp-smart-post-header-control-left"> |
| 17 |
<span className="sp-smart-post-component-title"> |
| 18 |
{label} |
| 19 |
</span> |
| 20 |
{attributes?.device && <Responsive />} |
| 21 |
</div> |
| 22 |
{units && ( |
| 23 |
<div className="sp-smart-post-header-control-right"> |
| 24 |
{onReset && <ResetButton onClick={() => onReset()} />} |
| 25 |
<Units |
| 26 |
attributes={attributes} |
| 27 |
setAttributes={setAttributes} |
| 28 |
attributesKey={attributesKey} |
| 29 |
units={units} |
| 30 |
onUnitChange={onUnitChange} |
| 31 |
/> |
| 32 |
</div> |
| 33 |
)} |
| 34 |
</div> |
| 35 |
); |
| 36 |
}; |
| 37 |
|
| 38 |
export default memo(ComponentsTopSection); |
| 39 |
|