/** * WordPress dependencies */ const { __ } = wp.i18n; const { ToggleControl, TextControl, Button, RangeControl, BaseControl, ButtonGroup, SelectControl, Dropdown, } = wp.components; /** * Internal dependencies */ import ColorControl from "../color-control"; import ResetControl from "../reset-control"; import ResponsiveDimensionsControl from "../dimensions-control-v2"; import { TypographyIcon } from "../icons"; export default function BorderShadowControl({ resRequiredProps, controlName, noBorder, noShadow, noBdrHover, noShdowHover, }) { const { setAttributes, attributes, objAttributes } = resRequiredProps; const { [`${controlName}borderStyle`]: borderStyle, [`${controlName}borderColor`]: borderColor, [`${controlName}shadowType`]: shadowType, [`${controlName}shadowColor`]: shadowColor, [`${controlName}hOffset`]: hOffset, [`${controlName}vOffset`]: vOffset, [`${controlName}blur`]: blur, [`${controlName}spread`]: spread, [`${controlName}hoverShadowColor`]: hoverShadowColor, [`${controlName}hoverHOffset`]: hoverHOffset, [`${controlName}hoverVOffset`]: hoverVOffset, [`${controlName}hoverBlur`]: hoverBlur, [`${controlName}hoverSpread`]: hoverSpread, [`${controlName}inset`]: inset, [`${controlName}BorderType`]: BorderType, [`${controlName}HborderStyle`]: HborderStyle, [`${controlName}HborderColor`]: HborderColor, [`${controlName}borderTransition`]: borderTransition, [`${controlName}radiusTransition`]: radiusTransition, [`${controlName}shadowTransition`]: shadowTransition, } = attributes; return ( <> {noBorder !== true && ( <> {!noBdrHover && ( {[ { label: "Normal", value: "normal" }, { label: "Hover", value: "hover" }, ].map(({ value, label }) => ( ))} )} {(BorderType === "normal" || noBdrHover) && ( <> setAttributes({ [`${controlName}borderStyle`]: borderStyle, }) } /> {borderStyle !== "none" && ( <> setAttributes({ [`${controlName}borderColor`]: borderColor, }) } /> )} )} {BorderType === "hover" && !noBdrHover && ( <> setAttributes({ [`${controlName}HborderStyle`]: HborderStyle, }) } /> {HborderStyle !== "none" && ( <> setAttributes({ [`${controlName}HborderColor`]: HborderColor, }) } /> setAttributes({ [`${controlName}borderTransition`]: borderTransition, }) } step={0.01} min={0} max={5} /> )} setAttributes({ [`${controlName}radiusTransition`]: radiusTransition, }) } step={0.01} min={0} max={5} /> )} )} {noShadow !== true && ( <> ( )} renderContent={() => ( <>
{!noShdowHover && ( {[ { label: "Normal", value: "normal" }, { label: "Hover", value: "hover" }, ].map(({ value, label }) => ( ))} )} setAttributes({ [`${controlName}inset`]: !inset }) } /> {(shadowType === "normal" || noShdowHover) && ( <> setAttributes({ [`${controlName}shadowColor`]: shadowColor, }) } /> setAttributes({ [`${controlName}hOffset`]: undefined, }) } > setAttributes({ [`${controlName}hOffset`]: hOffset, }) } min={0} max={200} /> setAttributes({ [`${controlName}vOffset`]: undefined, }) } > setAttributes({ [`${controlName}vOffset`]: vOffset, }) } min={0} max={200} /> setAttributes({ [`${controlName}blur`]: undefined }) } > setAttributes({ [`${controlName}blur`]: blur, }) } min={0} max={200} /> setAttributes({ [`${controlName}spread`]: undefined, }) } > setAttributes({ [`${controlName}spread`]: spread, }) } min={0} max={200} /> )} {shadowType === "hover" && !noShdowHover && ( <> setAttributes({ [`${controlName}hoverShadowColor`]: hoverShadowColor, }) } /> setAttributes({ [`${controlName}hoverHOffset`]: undefined, }) } > setAttributes({ [`${controlName}hoverHOffset`]: hoverHOffset, }) } min={0} max={200} /> setAttributes({ [`${controlName}hoverVOffset`]: undefined, }) } > setAttributes({ [`${controlName}hoverVOffset`]: hoverVOffset, }) } min={0} max={200} /> setAttributes({ [`${controlName}hoverBlur`]: undefined, }) } > setAttributes({ [`${controlName}hoverBlur`]: hoverBlur, }) } min={0} max={200} /> setAttributes({ [`${controlName}hoverSpread`]: undefined, }) } > setAttributes({ [`${controlName}hoverSpread`]: hoverSpread, }) } min={0} max={200} /> setAttributes({ [`${controlName}shadowTransition`]: shadowTransition, }) } step={0.01} min={0} max={5} /> )}
)} />
)} ); }