| 1 |
const { __ } = wp.i18n; |
| 2 |
const { MediaUpload } = wp.blockEditor; |
| 3 |
const { SelectControl, Button, RangeControl, BaseControl, ButtonGroup } = |
| 4 |
wp.components; |
| 5 |
|
| 6 |
/** |
| 7 |
* Internal dependencies |
| 8 |
*/ |
| 9 |
import GradientColorControl from "../gradient-color-controller"; |
| 10 |
import UnitControl from "../unit-control"; |
| 11 |
import ColorControl from "../color-control"; |
| 12 |
import ImageAvatar from "../image-avatar"; |
| 13 |
import WithResButtons from "../withResButtons"; |
| 14 |
|
| 15 |
export default function bgControl({ |
| 16 |
resRequiredProps, |
| 17 |
controlName, |
| 18 |
noMainBgi, |
| 19 |
noTransition, |
| 20 |
}) { |
| 21 |
const { setAttributes, attributes, resOption } = resRequiredProps; |
| 22 |
|
| 23 |
const { |
| 24 |
[`${controlName}bg_hoverType`]: bg_hoverType, |
| 25 |
[`${controlName}bg_transition`]: bg_transition, |
| 26 |
|
| 27 |
// attributes for bg_hoverType normal start ⬇ |
| 28 |
[`${controlName}backgroundType`]: backgroundType, |
| 29 |
[`${controlName}backgroundColor`]: backgroundColor, |
| 30 |
[`${controlName}gradientColor`]: gradientColor, |
| 31 |
[`${controlName}bgImageURL`]: bgImageURL, |
| 32 |
[`${controlName}bgImageID`]: bgImageID, |
| 33 |
[`${controlName}bgImgAttachment`]: bgImgAttachment, |
| 34 |
|
| 35 |
[`${controlName}backgroundSize`]: backgroundSize, |
| 36 |
[`${controlName}bgImgCustomSize`]: bgImgCustomSize, |
| 37 |
[`${controlName}bgImgCustomSizeUnit`]: bgImgCustomSizeUnit, |
| 38 |
[`${controlName}bgImgPos`]: bgImgPos, |
| 39 |
[`${controlName}bgImgcustomPosX`]: bgImgcustomPosX, |
| 40 |
[`${controlName}bgImgcustomPosXUnit`]: bgImgcustomPosXUnit, |
| 41 |
[`${controlName}bgImgcustomPosY`]: bgImgcustomPosY, |
| 42 |
[`${controlName}bgImgcustomPosYUnit`]: bgImgcustomPosYUnit, |
| 43 |
[`${controlName}bgImgRepeat`]: bgImgRepeat, |
| 44 |
|
| 45 |
[`TAB${controlName}backgroundSize`]: TABbackgroundSize, |
| 46 |
[`TAB${controlName}bgImgCustomSize`]: TABbgImgCustomSize, |
| 47 |
[`TAB${controlName}bgImgCustomSizeUnit`]: TABbgImgCustomSizeUnit, |
| 48 |
[`TAB${controlName}bgImgPos`]: TABbgImgPos, |
| 49 |
[`TAB${controlName}bgImgcustomPosX`]: TABbgImgcustomPosX, |
| 50 |
[`TAB${controlName}bgImgcustomPosXUnit`]: TABbgImgcustomPosXUnit, |
| 51 |
[`TAB${controlName}bgImgcustomPosY`]: TABbgImgcustomPosY, |
| 52 |
[`TAB${controlName}bgImgcustomPosYUnit`]: TABbgImgcustomPosYUnit, |
| 53 |
[`TAB${controlName}bgImgRepeat`]: TABbgImgRepeat, |
| 54 |
|
| 55 |
[`MOB${controlName}backgroundSize`]: MOBbackgroundSize, |
| 56 |
[`MOB${controlName}bgImgCustomSize`]: MOBbgImgCustomSize, |
| 57 |
[`MOB${controlName}bgImgCustomSizeUnit`]: MOBbgImgCustomSizeUnit, |
| 58 |
[`MOB${controlName}bgImgPos`]: MOBbgImgPos, |
| 59 |
[`MOB${controlName}bgImgcustomPosX`]: MOBbgImgcustomPosX, |
| 60 |
[`MOB${controlName}bgImgcustomPosXUnit`]: MOBbgImgcustomPosXUnit, |
| 61 |
[`MOB${controlName}bgImgcustomPosY`]: MOBbgImgcustomPosY, |
| 62 |
[`MOB${controlName}bgImgcustomPosYUnit`]: MOBbgImgcustomPosYUnit, |
| 63 |
[`MOB${controlName}bgImgRepeat`]: MOBbgImgRepeat, |
| 64 |
// attributes for bg_hoverType normal end |
| 65 |
|
| 66 |
// attributes for bg_hoverType hover start ⬇ |
| 67 |
[`hov_${controlName}backgroundType`]: hov_backgroundType, |
| 68 |
[`hov_${controlName}backgroundColor`]: hov_backgroundColor, |
| 69 |
[`hov_${controlName}gradientColor`]: hov_gradientColor, |
| 70 |
[`hov_${controlName}bgImageURL`]: hov_bgImageURL, |
| 71 |
[`hov_${controlName}bgImageID`]: hov_bgImageID, |
| 72 |
[`hov_${controlName}bgImgAttachment`]: hov_bgImgAttachment, |
| 73 |
|
| 74 |
[`hov_${controlName}backgroundSize`]: hov_backgroundSize, |
| 75 |
[`hov_${controlName}bgImgCustomSize`]: hov_bgImgCustomSize, |
| 76 |
[`hov_${controlName}bgImgCustomSizeUnit`]: hov_bgImgCustomSizeUnit, |
| 77 |
[`hov_${controlName}bgImgPos`]: hov_bgImgPos, |
| 78 |
[`hov_${controlName}bgImgcustomPosX`]: hov_bgImgcustomPosX, |
| 79 |
[`hov_${controlName}bgImgcustomPosXUnit`]: hov_bgImgcustomPosXUnit, |
| 80 |
[`hov_${controlName}bgImgcustomPosY`]: hov_bgImgcustomPosY, |
| 81 |
[`hov_${controlName}bgImgcustomPosYUnit`]: hov_bgImgcustomPosYUnit, |
| 82 |
[`hov_${controlName}bgImgRepeat`]: hov_bgImgRepeat, |
| 83 |
|
| 84 |
[`hov_TAB${controlName}backgroundSize`]: hov_TABbackgroundSize, |
| 85 |
[`hov_TAB${controlName}bgImgCustomSize`]: hov_TABbgImgCustomSize, |
| 86 |
[`hov_TAB${controlName}bgImgCustomSizeUnit`]: hov_TABbgImgCustomSizeUnit, |
| 87 |
[`hov_TAB${controlName}bgImgPos`]: hov_TABbgImgPos, |
| 88 |
[`hov_TAB${controlName}bgImgcustomPosX`]: hov_TABbgImgcustomPosX, |
| 89 |
[`hov_TAB${controlName}bgImgcustomPosXUnit`]: hov_TABbgImgcustomPosXUnit, |
| 90 |
[`hov_TAB${controlName}bgImgcustomPosY`]: hov_TABbgImgcustomPosY, |
| 91 |
[`hov_TAB${controlName}bgImgcustomPosYUnit`]: hov_TABbgImgcustomPosYUnit, |
| 92 |
[`hov_TAB${controlName}bgImgRepeat`]: hov_TABbgImgRepeat, |
| 93 |
|
| 94 |
[`hov_MOB${controlName}backgroundSize`]: hov_MOBbackgroundSize, |
| 95 |
[`hov_MOB${controlName}bgImgCustomSize`]: hov_MOBbgImgCustomSize, |
| 96 |
[`hov_MOB${controlName}bgImgCustomSizeUnit`]: hov_MOBbgImgCustomSizeUnit, |
| 97 |
[`hov_MOB${controlName}bgImgPos`]: hov_MOBbgImgPos, |
| 98 |
[`hov_MOB${controlName}bgImgcustomPosX`]: hov_MOBbgImgcustomPosX, |
| 99 |
[`hov_MOB${controlName}bgImgcustomPosXUnit`]: hov_MOBbgImgcustomPosXUnit, |
| 100 |
[`hov_MOB${controlName}bgImgcustomPosY`]: hov_MOBbgImgcustomPosY, |
| 101 |
[`hov_MOB${controlName}bgImgcustomPosYUnit`]: hov_MOBbgImgcustomPosYUnit, |
| 102 |
[`hov_MOB${controlName}bgImgRepeat`]: hov_MOBbgImgRepeat, |
| 103 |
// attributes for bg_hoverType hover end |
| 104 |
} = attributes; |
| 105 |
|
| 106 |
return ( |
| 107 |
<> |
| 108 |
<BaseControl> |
| 109 |
<ButtonGroup> |
| 110 |
{[ |
| 111 |
{ label: __("Normal", "betterdocs"), value: "normal" }, |
| 112 |
{ label: __("Hover", "betterdocs"), value: "hover" }, |
| 113 |
].map(({ value, label }) => ( |
| 114 |
<Button |
| 115 |
// isSmall |
| 116 |
// isLarge |
| 117 |
key={`bg-${value}`} |
| 118 |
isPrimary={bg_hoverType === value} |
| 119 |
isSecondary={bg_hoverType !== value} |
| 120 |
onClick={() => |
| 121 |
setAttributes({ |
| 122 |
[`${controlName}bg_hoverType`]: value, |
| 123 |
}) |
| 124 |
} |
| 125 |
> |
| 126 |
{label} |
| 127 |
</Button> |
| 128 |
))} |
| 129 |
</ButtonGroup> |
| 130 |
</BaseControl> |
| 131 |
|
| 132 |
{bg_hoverType === "normal" && ( |
| 133 |
<> |
| 134 |
<BaseControl label={__("Background Type", "betterdocs")}> |
| 135 |
<ButtonGroup> |
| 136 |
{[ |
| 137 |
{ label: __("Classic", "betterdocs"), value: "classic" }, |
| 138 |
{ label: __("Gradient", "betterdocs"), value: "gradient" }, |
| 139 |
].map(({ value, label }) => ( |
| 140 |
<Button |
| 141 |
// isSmall |
| 142 |
// isLarge |
| 143 |
key={`bg-${value}-normal`} |
| 144 |
isPrimary={backgroundType === value} |
| 145 |
isSecondary={backgroundType !== value} |
| 146 |
onClick={() => |
| 147 |
setAttributes({ |
| 148 |
[`${controlName}backgroundType`]: value, |
| 149 |
}) |
| 150 |
} |
| 151 |
> |
| 152 |
{label} |
| 153 |
</Button> |
| 154 |
))} |
| 155 |
</ButtonGroup> |
| 156 |
</BaseControl> |
| 157 |
|
| 158 |
{backgroundType === "classic" && ( |
| 159 |
<> |
| 160 |
<ColorControl |
| 161 |
label={__("Background Color", "betterdocs")} |
| 162 |
color={backgroundColor} |
| 163 |
onChange={(backgroundColor) => |
| 164 |
setAttributes({ |
| 165 |
[`${controlName}backgroundColor`]: backgroundColor, |
| 166 |
}) |
| 167 |
} |
| 168 |
/> |
| 169 |
|
| 170 |
{noMainBgi === false && ( |
| 171 |
<> |
| 172 |
<BaseControl label={__("Background Image", "betterdocs")}></BaseControl> |
| 173 |
|
| 174 |
<MediaUpload |
| 175 |
onSelect={({ url, id }) => |
| 176 |
setAttributes({ |
| 177 |
[`${controlName}bgImageURL`]: url, |
| 178 |
[`${controlName}bgImageID`]: id, |
| 179 |
}) |
| 180 |
} |
| 181 |
type="image" |
| 182 |
value={bgImageID} |
| 183 |
render={({ open }) => |
| 184 |
!bgImageURL && ( |
| 185 |
<> |
| 186 |
<Button |
| 187 |
className="eb-background-control-inspector-panel-img-btn components-button" |
| 188 |
label={__("Upload Image", "betterdocs")} |
| 189 |
icon="format-image" |
| 190 |
onClick={open} |
| 191 |
/> |
| 192 |
<span |
| 193 |
style={{ padding: "10px 0", display: "block" }} |
| 194 |
></span> |
| 195 |
</> |
| 196 |
) |
| 197 |
} |
| 198 |
/> |
| 199 |
|
| 200 |
{bgImageURL && ( |
| 201 |
<> |
| 202 |
<ImageAvatar |
| 203 |
imageUrl={bgImageURL} |
| 204 |
onDeleteImage={() => |
| 205 |
setAttributes({ [`${controlName}bgImageURL`]: null }) |
| 206 |
} |
| 207 |
/> |
| 208 |
|
| 209 |
{resOption === "Desktop" && ( |
| 210 |
<> |
| 211 |
<WithResButtons |
| 212 |
resRequiredProps={resRequiredProps} |
| 213 |
label="Position" |
| 214 |
> |
| 215 |
<SelectControl |
| 216 |
value={bgImgPos} |
| 217 |
options={[ |
| 218 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 219 |
{ |
| 220 |
label: __("Center Center", "betterdocs"), |
| 221 |
value: "center center", |
| 222 |
}, |
| 223 |
{ |
| 224 |
label: __("Center Left", "betterdocs"), |
| 225 |
value: "center left", |
| 226 |
}, |
| 227 |
{ |
| 228 |
label: __("Center Right", "betterdocs"), |
| 229 |
value: "center right", |
| 230 |
}, |
| 231 |
{ |
| 232 |
label: __("Top Center", "betterdocs"), |
| 233 |
value: "top center", |
| 234 |
}, |
| 235 |
{ label: __("Top Left", "betterdocs"), value: "top left" }, |
| 236 |
{ label: __("Top Right", "betterdocs"), value: "top right" }, |
| 237 |
{ |
| 238 |
label: __("Bottom Center", "betterdocs"), |
| 239 |
value: "bottom center", |
| 240 |
}, |
| 241 |
{ |
| 242 |
label: __("Bottom Left", "betterdocs"), |
| 243 |
value: "bottom left", |
| 244 |
}, |
| 245 |
{ |
| 246 |
label: __("Bottom Right", "betterdocs"), |
| 247 |
value: "bottom right", |
| 248 |
}, |
| 249 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 250 |
]} |
| 251 |
onChange={(bgImgPos) => |
| 252 |
setAttributes({ |
| 253 |
[`${controlName}bgImgPos`]: bgImgPos, |
| 254 |
}) |
| 255 |
} |
| 256 |
/> |
| 257 |
</WithResButtons> |
| 258 |
|
| 259 |
{bgImgPos === "custom" && ( |
| 260 |
<> |
| 261 |
<UnitControl |
| 262 |
selectedUnit={bgImgcustomPosXUnit} |
| 263 |
unitTypes={[ |
| 264 |
{ label: "px", value: "px" }, |
| 265 |
{ label: "em", value: "em" }, |
| 266 |
{ label: "%", value: "%" }, |
| 267 |
]} |
| 268 |
onClick={(bgImgcustomPosXUnit) => |
| 269 |
setAttributes({ |
| 270 |
[`${controlName}bgImgcustomPosXUnit`]: |
| 271 |
bgImgcustomPosXUnit, |
| 272 |
}) |
| 273 |
} |
| 274 |
/> |
| 275 |
|
| 276 |
<WithResButtons |
| 277 |
resRequiredProps={resRequiredProps} |
| 278 |
label="X Position" |
| 279 |
> |
| 280 |
<RangeControl |
| 281 |
value={bgImgcustomPosX} |
| 282 |
min={-2000} |
| 283 |
max={ |
| 284 |
// bgImgcustomPosXUnit === "px" ? |
| 285 |
2000 |
| 286 |
// : 100 |
| 287 |
} |
| 288 |
onChange={(bgImgcustomPosX) => |
| 289 |
setAttributes({ |
| 290 |
[`${controlName}bgImgcustomPosX`]: |
| 291 |
bgImgcustomPosX, |
| 292 |
}) |
| 293 |
} |
| 294 |
/> |
| 295 |
</WithResButtons> |
| 296 |
|
| 297 |
<UnitControl |
| 298 |
selectedUnit={bgImgcustomPosYUnit} |
| 299 |
unitTypes={[ |
| 300 |
{ label: "px", value: "px" }, |
| 301 |
{ label: "em", value: "em" }, |
| 302 |
{ label: "%", value: "%" }, |
| 303 |
]} |
| 304 |
onClick={(bgImgcustomPosYUnit) => |
| 305 |
setAttributes({ |
| 306 |
[`${controlName}bgImgcustomPosYUnit`]: |
| 307 |
bgImgcustomPosYUnit, |
| 308 |
}) |
| 309 |
} |
| 310 |
/> |
| 311 |
|
| 312 |
<WithResButtons |
| 313 |
resRequiredProps={resRequiredProps} |
| 314 |
label="Y Position" |
| 315 |
> |
| 316 |
<RangeControl |
| 317 |
value={bgImgcustomPosY} |
| 318 |
min={-2000} |
| 319 |
max={ |
| 320 |
// bgImgcustomPosYUnit === "px" ? |
| 321 |
2000 |
| 322 |
// : 100 |
| 323 |
} |
| 324 |
step={bgImgcustomPosYUnit === "px" ? 1 : 0.1} |
| 325 |
onChange={(bgImgcustomPosY) => |
| 326 |
setAttributes({ |
| 327 |
[`${controlName}bgImgcustomPosY`]: |
| 328 |
bgImgcustomPosY, |
| 329 |
}) |
| 330 |
} |
| 331 |
/> |
| 332 |
</WithResButtons> |
| 333 |
</> |
| 334 |
)} |
| 335 |
|
| 336 |
<SelectControl |
| 337 |
label="Attachment" |
| 338 |
value={bgImgAttachment} |
| 339 |
options={[ |
| 340 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 341 |
{ label: __("Scroll", "betterdocs"), value: "scroll" }, |
| 342 |
{ label: __("Fixed", "betterdocs"), value: "fixed" }, |
| 343 |
]} |
| 344 |
onChange={(bgImgAttachment) => |
| 345 |
setAttributes({ |
| 346 |
[`${controlName}bgImgAttachment`]: |
| 347 |
bgImgAttachment, |
| 348 |
}) |
| 349 |
} |
| 350 |
/> |
| 351 |
|
| 352 |
{bgImgAttachment === "fixed" && ( |
| 353 |
<p |
| 354 |
style={{ |
| 355 |
marginTop: "-10px", |
| 356 |
paddingBottom: "10px", |
| 357 |
}} |
| 358 |
> |
| 359 |
<i> |
| 360 |
Note: Attachment Fixed works only on desktop. |
| 361 |
</i> |
| 362 |
</p> |
| 363 |
)} |
| 364 |
|
| 365 |
<WithResButtons |
| 366 |
resRequiredProps={resRequiredProps} |
| 367 |
label="Repeat" |
| 368 |
> |
| 369 |
<SelectControl |
| 370 |
value={bgImgRepeat} |
| 371 |
options={[ |
| 372 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 373 |
{ label: __("No-repeat", "betterdocs"), value: "no-repeat" }, |
| 374 |
{ label: __("Repeat", "betterdocs"), value: "repeat" }, |
| 375 |
{ label: __("Repeat-x", "betterdocs"), value: "repeat-x" }, |
| 376 |
{ label: __("Repeat-y", "betterdocs"), value: "repeat-y" }, |
| 377 |
]} |
| 378 |
onChange={(bgImgRepeat) => |
| 379 |
setAttributes({ |
| 380 |
[`${controlName}bgImgRepeat`]: bgImgRepeat, |
| 381 |
}) |
| 382 |
} |
| 383 |
/> |
| 384 |
</WithResButtons> |
| 385 |
|
| 386 |
<WithResButtons |
| 387 |
resRequiredProps={resRequiredProps} |
| 388 |
label="Size" |
| 389 |
> |
| 390 |
<SelectControl |
| 391 |
value={backgroundSize} |
| 392 |
options={[ |
| 393 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 394 |
{ label: __("Auto", "betterdocs"), value: "auto" }, |
| 395 |
{ label: __("Cover", "betterdocs"), value: "cover" }, |
| 396 |
{ label: __("Contain", "betterdocs"), value: "contain" }, |
| 397 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 398 |
]} |
| 399 |
onChange={(backgroundSize) => |
| 400 |
setAttributes({ |
| 401 |
[`${controlName}backgroundSize`]: |
| 402 |
backgroundSize, |
| 403 |
}) |
| 404 |
} |
| 405 |
/> |
| 406 |
</WithResButtons> |
| 407 |
|
| 408 |
{backgroundSize === "custom" && ( |
| 409 |
<> |
| 410 |
<UnitControl |
| 411 |
selectedUnit={bgImgCustomSizeUnit} |
| 412 |
unitTypes={[ |
| 413 |
{ label: "px", value: "px" }, |
| 414 |
{ label: "em", value: "em" }, |
| 415 |
{ label: "%", value: "%" }, |
| 416 |
]} |
| 417 |
onClick={(bgImgCustomSizeUnit) => |
| 418 |
setAttributes({ |
| 419 |
[`${controlName}bgImgCustomSizeUnit`]: |
| 420 |
bgImgCustomSizeUnit, |
| 421 |
}) |
| 422 |
} |
| 423 |
/> |
| 424 |
|
| 425 |
<WithResButtons |
| 426 |
resRequiredProps={resRequiredProps} |
| 427 |
label="Width" |
| 428 |
> |
| 429 |
<RangeControl |
| 430 |
value={bgImgCustomSize} |
| 431 |
min={0} |
| 432 |
max={ |
| 433 |
bgImgCustomSizeUnit === "px" ? 2000 : 100 |
| 434 |
} |
| 435 |
step={bgImgCustomSizeUnit === "px" ? 1 : 0.1} |
| 436 |
onChange={(bgImgCustomSize) => |
| 437 |
setAttributes({ |
| 438 |
[`${controlName}bgImgCustomSize`]: |
| 439 |
bgImgCustomSize, |
| 440 |
}) |
| 441 |
} |
| 442 |
/> |
| 443 |
</WithResButtons> |
| 444 |
</> |
| 445 |
)} |
| 446 |
</> |
| 447 |
)} |
| 448 |
|
| 449 |
{resOption === "Tablet" && ( |
| 450 |
<> |
| 451 |
<WithResButtons |
| 452 |
resRequiredProps={resRequiredProps} |
| 453 |
label="Position" |
| 454 |
> |
| 455 |
<SelectControl |
| 456 |
value={TABbgImgPos} |
| 457 |
options={[ |
| 458 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 459 |
{ |
| 460 |
label: __("Center Center", "betterdocs"), |
| 461 |
value: "center center", |
| 462 |
}, |
| 463 |
{ |
| 464 |
label: __("Center Left", "betterdocs"), |
| 465 |
value: "center left", |
| 466 |
}, |
| 467 |
{ |
| 468 |
label: __("Center Right", "betterdocs"), |
| 469 |
value: "center right", |
| 470 |
}, |
| 471 |
{ |
| 472 |
label: __("Top Center", "betterdocs"), |
| 473 |
value: "top center", |
| 474 |
}, |
| 475 |
{ label: __("Top Left", "betterdocs"), value: "top left" }, |
| 476 |
{ label: __("Top Right", "betterdocs"), value: "top right" }, |
| 477 |
{ |
| 478 |
label: __("Bottom Center", "betterdocs"), |
| 479 |
value: "bottom center", |
| 480 |
}, |
| 481 |
{ |
| 482 |
label: __("Bottom Left", "betterdocs"), |
| 483 |
value: "bottom left", |
| 484 |
}, |
| 485 |
{ |
| 486 |
label: __("Bottom Right", "betterdocs"), |
| 487 |
value: "bottom right", |
| 488 |
}, |
| 489 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 490 |
]} |
| 491 |
onChange={(TABbgImgPos) => |
| 492 |
setAttributes({ |
| 493 |
[`TAB${controlName}bgImgPos`]: TABbgImgPos, |
| 494 |
}) |
| 495 |
} |
| 496 |
/> |
| 497 |
</WithResButtons> |
| 498 |
|
| 499 |
{TABbgImgPos === "custom" && ( |
| 500 |
<> |
| 501 |
<UnitControl |
| 502 |
selectedUnit={TABbgImgcustomPosXUnit} |
| 503 |
unitTypes={[ |
| 504 |
{ label: "px", value: "px" }, |
| 505 |
{ label: "em", value: "em" }, |
| 506 |
{ label: "%", value: "%" }, |
| 507 |
]} |
| 508 |
onClick={(TABbgImgcustomPosXUnit) => |
| 509 |
setAttributes({ |
| 510 |
[`TAB${controlName}bgImgcustomPosXUnit`]: |
| 511 |
TABbgImgcustomPosXUnit, |
| 512 |
}) |
| 513 |
} |
| 514 |
/> |
| 515 |
|
| 516 |
<WithResButtons |
| 517 |
resRequiredProps={resRequiredProps} |
| 518 |
label="X Position" |
| 519 |
> |
| 520 |
<RangeControl |
| 521 |
value={TABbgImgcustomPosX} |
| 522 |
min={0} |
| 523 |
max={ |
| 524 |
TABbgImgcustomPosXUnit === "px" ? 2000 : 100 |
| 525 |
} |
| 526 |
onChange={(TABbgImgcustomPosX) => |
| 527 |
setAttributes({ |
| 528 |
[`TAB${controlName}bgImgcustomPosX`]: |
| 529 |
TABbgImgcustomPosX, |
| 530 |
}) |
| 531 |
} |
| 532 |
/> |
| 533 |
</WithResButtons> |
| 534 |
|
| 535 |
<UnitControl |
| 536 |
selectedUnit={TABbgImgcustomPosYUnit} |
| 537 |
unitTypes={[ |
| 538 |
{ label: "px", value: "px" }, |
| 539 |
{ label: "em", value: "em" }, |
| 540 |
{ label: "%", value: "%" }, |
| 541 |
]} |
| 542 |
onClick={(TABbgImgcustomPosYUnit) => |
| 543 |
setAttributes({ |
| 544 |
[`TAB${controlName}bgImgcustomPosYUnit`]: |
| 545 |
TABbgImgcustomPosYUnit, |
| 546 |
}) |
| 547 |
} |
| 548 |
/> |
| 549 |
|
| 550 |
<WithResButtons |
| 551 |
resRequiredProps={resRequiredProps} |
| 552 |
label="Y Position" |
| 553 |
> |
| 554 |
<RangeControl |
| 555 |
value={TABbgImgcustomPosY} |
| 556 |
min={0} |
| 557 |
max={ |
| 558 |
TABbgImgcustomPosYUnit === "px" ? 2000 : 100 |
| 559 |
} |
| 560 |
step={ |
| 561 |
TABbgImgcustomPosYUnit === "px" ? 1 : 0.1 |
| 562 |
} |
| 563 |
onChange={(TABbgImgcustomPosY) => |
| 564 |
setAttributes({ |
| 565 |
[`TAB${controlName}bgImgcustomPosY`]: |
| 566 |
TABbgImgcustomPosY, |
| 567 |
}) |
| 568 |
} |
| 569 |
/> |
| 570 |
</WithResButtons> |
| 571 |
</> |
| 572 |
)} |
| 573 |
|
| 574 |
<SelectControl |
| 575 |
label="Attachment" |
| 576 |
value={bgImgAttachment} |
| 577 |
options={[ |
| 578 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 579 |
{ label: __("Scroll", "betterdocs"), value: "scroll" }, |
| 580 |
{ label: __("Fixed", "betterdocs"), value: "fixed" }, |
| 581 |
]} |
| 582 |
onChange={(bgImgAttachment) => |
| 583 |
setAttributes({ |
| 584 |
[`${controlName}bgImgAttachment`]: |
| 585 |
bgImgAttachment, |
| 586 |
}) |
| 587 |
} |
| 588 |
/> |
| 589 |
|
| 590 |
{bgImgAttachment === "fixed" && ( |
| 591 |
<p |
| 592 |
style={{ |
| 593 |
marginTop: "-10px", |
| 594 |
paddingBottom: "10px", |
| 595 |
}} |
| 596 |
> |
| 597 |
<i> |
| 598 |
Note: Attachment Fixed works only on desktop. |
| 599 |
</i> |
| 600 |
</p> |
| 601 |
)} |
| 602 |
|
| 603 |
<WithResButtons |
| 604 |
resRequiredProps={resRequiredProps} |
| 605 |
label="Repeat" |
| 606 |
> |
| 607 |
<SelectControl |
| 608 |
value={TABbgImgRepeat} |
| 609 |
options={[ |
| 610 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 611 |
{ label: __("No-repeat", "betterdocs"), value: "no-repeat" }, |
| 612 |
{ label: __("Repeat", "betterdocs"), value: "repeat" }, |
| 613 |
{ label: __("Repeat-x", "betterdocs"), value: "repeat-x" }, |
| 614 |
{ label: __("Repeat-y", "betterdocs"), value: "repeat-y" }, |
| 615 |
]} |
| 616 |
onChange={(TABbgImgRepeat) => |
| 617 |
setAttributes({ |
| 618 |
[`TAB${controlName}bgImgRepeat`]: |
| 619 |
TABbgImgRepeat, |
| 620 |
}) |
| 621 |
} |
| 622 |
/> |
| 623 |
</WithResButtons> |
| 624 |
|
| 625 |
<WithResButtons |
| 626 |
resRequiredProps={resRequiredProps} |
| 627 |
label="Size" |
| 628 |
> |
| 629 |
<SelectControl |
| 630 |
value={TABbackgroundSize} |
| 631 |
options={[ |
| 632 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 633 |
{ label: __("Auto", "betterdocs"), value: "auto" }, |
| 634 |
{ label: __("Cover", "betterdocs"), value: "cover" }, |
| 635 |
{ label: __("Contain", "betterdocs"), value: "contain" }, |
| 636 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 637 |
]} |
| 638 |
onChange={(TABbackgroundSize) => |
| 639 |
setAttributes({ |
| 640 |
[`TAB${controlName}backgroundSize`]: |
| 641 |
TABbackgroundSize, |
| 642 |
}) |
| 643 |
} |
| 644 |
/> |
| 645 |
</WithResButtons> |
| 646 |
|
| 647 |
{TABbackgroundSize === "custom" && ( |
| 648 |
<> |
| 649 |
<UnitControl |
| 650 |
selectedUnit={TABbgImgCustomSizeUnit} |
| 651 |
unitTypes={[ |
| 652 |
{ label: "px", value: "px" }, |
| 653 |
{ label: "em", value: "em" }, |
| 654 |
{ label: "%", value: "%" }, |
| 655 |
]} |
| 656 |
onClick={(TABbgImgCustomSizeUnit) => |
| 657 |
setAttributes({ |
| 658 |
[`TAB${controlName}bgImgCustomSizeUnit`]: |
| 659 |
TABbgImgCustomSizeUnit, |
| 660 |
}) |
| 661 |
} |
| 662 |
/> |
| 663 |
|
| 664 |
<WithResButtons |
| 665 |
resRequiredProps={resRequiredProps} |
| 666 |
label="Width" |
| 667 |
> |
| 668 |
<RangeControl |
| 669 |
value={TABbgImgCustomSize} |
| 670 |
min={0} |
| 671 |
max={ |
| 672 |
TABbgImgCustomSizeUnit === "px" ? 2000 : 100 |
| 673 |
} |
| 674 |
step={ |
| 675 |
TABbgImgCustomSizeUnit === "px" ? 1 : 0.1 |
| 676 |
} |
| 677 |
onChange={(TABbgImgCustomSize) => |
| 678 |
setAttributes({ |
| 679 |
[`TAB${controlName}bgImgCustomSize`]: |
| 680 |
TABbgImgCustomSize, |
| 681 |
}) |
| 682 |
} |
| 683 |
/> |
| 684 |
</WithResButtons> |
| 685 |
</> |
| 686 |
)} |
| 687 |
</> |
| 688 |
)} |
| 689 |
|
| 690 |
{resOption === "Mobile" && ( |
| 691 |
<> |
| 692 |
<WithResButtons |
| 693 |
resRequiredProps={resRequiredProps} |
| 694 |
label="Position" |
| 695 |
> |
| 696 |
<SelectControl |
| 697 |
value={MOBbgImgPos} |
| 698 |
options={[ |
| 699 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 700 |
{ |
| 701 |
label: __("Center Center", "betterdocs"), |
| 702 |
value: "center center", |
| 703 |
}, |
| 704 |
{ |
| 705 |
label: __("Center Left", "betterdocs"), |
| 706 |
value: "center left", |
| 707 |
}, |
| 708 |
{ |
| 709 |
label: __("Center Right", "betterdocs"), |
| 710 |
value: "center right", |
| 711 |
}, |
| 712 |
{ |
| 713 |
label: __("Top Center", "betterdocs"), |
| 714 |
value: "top center", |
| 715 |
}, |
| 716 |
{ label: __("Top Left", "betterdocs"), value: "top left" }, |
| 717 |
{ label: __("Top Right", "betterdocs"), value: "top right" }, |
| 718 |
{ |
| 719 |
label: __("Bottom Center", "betterdocs"), |
| 720 |
value: "bottom center", |
| 721 |
}, |
| 722 |
{ |
| 723 |
label: __("Bottom Left", "betterdocs"), |
| 724 |
value: "bottom left", |
| 725 |
}, |
| 726 |
{ |
| 727 |
label: __("Bottom Right", "betterdocs"), |
| 728 |
value: "bottom right", |
| 729 |
}, |
| 730 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 731 |
]} |
| 732 |
onChange={(MOBbgImgPos) => |
| 733 |
setAttributes({ |
| 734 |
[`MOB${controlName}bgImgPos`]: MOBbgImgPos, |
| 735 |
}) |
| 736 |
} |
| 737 |
/> |
| 738 |
</WithResButtons> |
| 739 |
|
| 740 |
{MOBbgImgPos === "custom" && ( |
| 741 |
<> |
| 742 |
<UnitControl |
| 743 |
selectedUnit={MOBbgImgcustomPosXUnit} |
| 744 |
unitTypes={[ |
| 745 |
{ label: "px", value: "px" }, |
| 746 |
{ label: "em", value: "em" }, |
| 747 |
{ label: "%", value: "%" }, |
| 748 |
]} |
| 749 |
onClick={(MOBbgImgcustomPosXUnit) => |
| 750 |
setAttributes({ |
| 751 |
[`MOB${controlName}bgImgcustomPosXUnit`]: |
| 752 |
MOBbgImgcustomPosXUnit, |
| 753 |
}) |
| 754 |
} |
| 755 |
/> |
| 756 |
|
| 757 |
<WithResButtons |
| 758 |
resRequiredProps={resRequiredProps} |
| 759 |
label="X Position" |
| 760 |
> |
| 761 |
<RangeControl |
| 762 |
value={MOBbgImgcustomPosX} |
| 763 |
min={0} |
| 764 |
max={ |
| 765 |
MOBbgImgcustomPosXUnit === "px" ? 2000 : 100 |
| 766 |
} |
| 767 |
onChange={(MOBbgImgcustomPosX) => |
| 768 |
setAttributes({ |
| 769 |
[`MOB${controlName}bgImgcustomPosX`]: |
| 770 |
MOBbgImgcustomPosX, |
| 771 |
}) |
| 772 |
} |
| 773 |
/> |
| 774 |
</WithResButtons> |
| 775 |
|
| 776 |
<UnitControl |
| 777 |
selectedUnit={MOBbgImgcustomPosYUnit} |
| 778 |
unitTypes={[ |
| 779 |
{ label: "px", value: "px" }, |
| 780 |
{ label: "em", value: "em" }, |
| 781 |
{ label: "%", value: "%" }, |
| 782 |
]} |
| 783 |
onClick={(MOBbgImgcustomPosYUnit) => |
| 784 |
setAttributes({ |
| 785 |
[`MOB${controlName}bgImgcustomPosYUnit`]: |
| 786 |
MOBbgImgcustomPosYUnit, |
| 787 |
}) |
| 788 |
} |
| 789 |
/> |
| 790 |
|
| 791 |
<WithResButtons |
| 792 |
resRequiredProps={resRequiredProps} |
| 793 |
label="Y Position" |
| 794 |
> |
| 795 |
<RangeControl |
| 796 |
value={MOBbgImgcustomPosY} |
| 797 |
min={0} |
| 798 |
max={ |
| 799 |
MOBbgImgcustomPosYUnit === "px" ? 2000 : 100 |
| 800 |
} |
| 801 |
step={ |
| 802 |
MOBbgImgcustomPosYUnit === "px" ? 1 : 0.1 |
| 803 |
} |
| 804 |
onChange={(MOBbgImgcustomPosY) => |
| 805 |
setAttributes({ |
| 806 |
[`MOB${controlName}bgImgcustomPosY`]: |
| 807 |
MOBbgImgcustomPosY, |
| 808 |
}) |
| 809 |
} |
| 810 |
/> |
| 811 |
</WithResButtons> |
| 812 |
</> |
| 813 |
)} |
| 814 |
|
| 815 |
<SelectControl |
| 816 |
label="Attachment" |
| 817 |
value={bgImgAttachment} |
| 818 |
options={[ |
| 819 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 820 |
{ label: __("Scroll", "betterdocs"), value: "scroll" }, |
| 821 |
{ label: __("Fixed", "betterdocs"), value: "fixed" }, |
| 822 |
]} |
| 823 |
onChange={(bgImgAttachment) => |
| 824 |
setAttributes({ |
| 825 |
[`${controlName}bgImgAttachment`]: |
| 826 |
bgImgAttachment, |
| 827 |
}) |
| 828 |
} |
| 829 |
/> |
| 830 |
|
| 831 |
{bgImgAttachment === "fixed" && ( |
| 832 |
<p |
| 833 |
style={{ |
| 834 |
marginTop: "-10px", |
| 835 |
paddingBottom: "10px", |
| 836 |
}} |
| 837 |
> |
| 838 |
<i> |
| 839 |
Note: Attachment Fixed works only on desktop. |
| 840 |
</i> |
| 841 |
</p> |
| 842 |
)} |
| 843 |
|
| 844 |
<WithResButtons |
| 845 |
resRequiredProps={resRequiredProps} |
| 846 |
label="Repeat" |
| 847 |
> |
| 848 |
<SelectControl |
| 849 |
value={MOBbgImgRepeat} |
| 850 |
options={[ |
| 851 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 852 |
{ label: __("No-repeat", "betterdocs"), value: "no-repeat" }, |
| 853 |
{ label: __("Repeat", "betterdocs"), value: "repeat" }, |
| 854 |
{ label: __("Repeat-x", "betterdocs"), value: "repeat-x" }, |
| 855 |
{ label: __("Repeat-y", "betterdocs"), value: "repeat-y" }, |
| 856 |
]} |
| 857 |
onChange={(MOBbgImgRepeat) => |
| 858 |
setAttributes({ |
| 859 |
[`MOB${controlName}bgImgRepeat`]: |
| 860 |
MOBbgImgRepeat, |
| 861 |
}) |
| 862 |
} |
| 863 |
/> |
| 864 |
</WithResButtons> |
| 865 |
|
| 866 |
<WithResButtons |
| 867 |
resRequiredProps={resRequiredProps} |
| 868 |
label="Size" |
| 869 |
> |
| 870 |
<SelectControl |
| 871 |
value={MOBbackgroundSize} |
| 872 |
options={[ |
| 873 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 874 |
{ label: __("Auto", "betterdocs"), value: "auto" }, |
| 875 |
{ label: __("Cover", "betterdocs"), value: "cover" }, |
| 876 |
{ label: __("Contain", "betterdocs"), value: "contain" }, |
| 877 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 878 |
]} |
| 879 |
onChange={(MOBbackgroundSize) => |
| 880 |
setAttributes({ |
| 881 |
[`MOB${controlName}backgroundSize`]: |
| 882 |
MOBbackgroundSize, |
| 883 |
}) |
| 884 |
} |
| 885 |
/> |
| 886 |
</WithResButtons> |
| 887 |
|
| 888 |
{MOBbackgroundSize === "custom" && ( |
| 889 |
<> |
| 890 |
<UnitControl |
| 891 |
selectedUnit={MOBbgImgCustomSizeUnit} |
| 892 |
unitTypes={[ |
| 893 |
{ label: "px", value: "px" }, |
| 894 |
{ label: "em", value: "em" }, |
| 895 |
{ label: "%", value: "%" }, |
| 896 |
]} |
| 897 |
onClick={(MOBbgImgCustomSizeUnit) => |
| 898 |
setAttributes({ |
| 899 |
[`MOB${controlName}bgImgCustomSizeUnit`]: |
| 900 |
MOBbgImgCustomSizeUnit, |
| 901 |
}) |
| 902 |
} |
| 903 |
/> |
| 904 |
|
| 905 |
<WithResButtons |
| 906 |
resRequiredProps={resRequiredProps} |
| 907 |
label="Width" |
| 908 |
> |
| 909 |
<RangeControl |
| 910 |
value={MOBbgImgCustomSize} |
| 911 |
min={0} |
| 912 |
max={ |
| 913 |
MOBbgImgCustomSizeUnit === "px" ? 2000 : 100 |
| 914 |
} |
| 915 |
step={ |
| 916 |
MOBbgImgCustomSizeUnit === "px" ? 1 : 0.1 |
| 917 |
} |
| 918 |
onChange={(MOBbgImgCustomSize) => |
| 919 |
setAttributes({ |
| 920 |
[`MOB${controlName}bgImgCustomSize`]: |
| 921 |
MOBbgImgCustomSize, |
| 922 |
}) |
| 923 |
} |
| 924 |
/> |
| 925 |
</WithResButtons> |
| 926 |
</> |
| 927 |
)} |
| 928 |
</> |
| 929 |
)} |
| 930 |
</> |
| 931 |
)} |
| 932 |
</> |
| 933 |
)} |
| 934 |
</> |
| 935 |
)} |
| 936 |
|
| 937 |
{backgroundType === "gradient" && ( |
| 938 |
<GradientColorControl |
| 939 |
gradientColor={gradientColor} |
| 940 |
onChange={(gradientColor) => |
| 941 |
setAttributes({ |
| 942 |
[`${controlName}gradientColor`]: gradientColor, |
| 943 |
}) |
| 944 |
} |
| 945 |
/> |
| 946 |
)} |
| 947 |
</> |
| 948 |
)} |
| 949 |
|
| 950 |
{bg_hoverType === "hover" && ( |
| 951 |
<> |
| 952 |
<BaseControl label={__("Background Type", "betterdocs")}> |
| 953 |
<ButtonGroup> |
| 954 |
{[ |
| 955 |
{ label: __("Classic", "betterdocs"), value: "classic" }, |
| 956 |
{ label: __("Gradient", "betterdocs"), value: "gradient" }, |
| 957 |
].map(({ value, label }) => ( |
| 958 |
<Button |
| 959 |
// isSmall |
| 960 |
// isLarge |
| 961 |
key={`bg-${value}-hover`} |
| 962 |
isPrimary={hov_backgroundType === value} |
| 963 |
isSecondary={hov_backgroundType !== value} |
| 964 |
onClick={() => |
| 965 |
setAttributes({ |
| 966 |
[`hov_${controlName}backgroundType`]: value, |
| 967 |
}) |
| 968 |
} |
| 969 |
> |
| 970 |
{label} |
| 971 |
</Button> |
| 972 |
))} |
| 973 |
</ButtonGroup> |
| 974 |
</BaseControl> |
| 975 |
|
| 976 |
{hov_backgroundType === "classic" && ( |
| 977 |
<> |
| 978 |
<ColorControl |
| 979 |
label={__("Background Color", "betterdocs")} |
| 980 |
color={hov_backgroundColor} |
| 981 |
onChange={(hov_backgroundColor) => |
| 982 |
setAttributes({ |
| 983 |
[`hov_${controlName}backgroundColor`]: hov_backgroundColor, |
| 984 |
}) |
| 985 |
} |
| 986 |
/> |
| 987 |
|
| 988 |
{noMainBgi === false && ( |
| 989 |
<> |
| 990 |
<BaseControl label={__("Background Image", "betterdocs")}></BaseControl> |
| 991 |
|
| 992 |
<MediaUpload |
| 993 |
onSelect={({ url, id }) => |
| 994 |
setAttributes({ |
| 995 |
[`hov_${controlName}bgImageURL`]: url, |
| 996 |
[`hov_${controlName}bgImageID`]: id, |
| 997 |
}) |
| 998 |
} |
| 999 |
type="image" |
| 1000 |
value={hov_bgImageID} |
| 1001 |
render={({ open }) => |
| 1002 |
!hov_bgImageURL && ( |
| 1003 |
<> |
| 1004 |
<Button |
| 1005 |
className="eb-background-control-inspector-panel-img-btn components-button" |
| 1006 |
label={__("Upload Image", "betterdocs")} |
| 1007 |
icon="format-image" |
| 1008 |
onClick={open} |
| 1009 |
/> |
| 1010 |
<span |
| 1011 |
style={{ padding: "10px 0", display: "block" }} |
| 1012 |
></span> |
| 1013 |
</> |
| 1014 |
) |
| 1015 |
} |
| 1016 |
/> |
| 1017 |
|
| 1018 |
{hov_bgImageURL && ( |
| 1019 |
<> |
| 1020 |
<ImageAvatar |
| 1021 |
imageUrl={hov_bgImageURL} |
| 1022 |
onDeleteImage={() => |
| 1023 |
setAttributes({ |
| 1024 |
[`hov_${controlName}bgImageURL`]: null, |
| 1025 |
}) |
| 1026 |
} |
| 1027 |
/> |
| 1028 |
|
| 1029 |
{resOption === "Desktop" && ( |
| 1030 |
<> |
| 1031 |
<WithResButtons |
| 1032 |
resRequiredProps={resRequiredProps} |
| 1033 |
label="Position" |
| 1034 |
> |
| 1035 |
<SelectControl |
| 1036 |
value={hov_bgImgPos} |
| 1037 |
options={[ |
| 1038 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1039 |
{ |
| 1040 |
label: __("Center Center", "betterdocs"), |
| 1041 |
value: "center center", |
| 1042 |
}, |
| 1043 |
{ |
| 1044 |
label: __("Center Left", "betterdocs"), |
| 1045 |
value: "center left", |
| 1046 |
}, |
| 1047 |
{ |
| 1048 |
label: __("Center Right", "betterdocs"), |
| 1049 |
value: "center right", |
| 1050 |
}, |
| 1051 |
{ |
| 1052 |
label: __("Top Center", "betterdocs"), |
| 1053 |
value: "top center", |
| 1054 |
}, |
| 1055 |
{ label: __("Top Left", "betterdocs"), value: "top left" }, |
| 1056 |
{ label: __("Top Right", "betterdocs"), value: "top right" }, |
| 1057 |
{ |
| 1058 |
label: __("Bottom Center", "betterdocs"), |
| 1059 |
value: "bottom center", |
| 1060 |
}, |
| 1061 |
{ |
| 1062 |
label: __("Bottom Left", "betterdocs"), |
| 1063 |
value: "bottom left", |
| 1064 |
}, |
| 1065 |
{ |
| 1066 |
label: __("Bottom Right", "betterdocs"), |
| 1067 |
value: "bottom right", |
| 1068 |
}, |
| 1069 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 1070 |
]} |
| 1071 |
onChange={(hov_bgImgPos) => |
| 1072 |
setAttributes({ |
| 1073 |
[`hov_${controlName}bgImgPos`]: hov_bgImgPos, |
| 1074 |
}) |
| 1075 |
} |
| 1076 |
/> |
| 1077 |
</WithResButtons> |
| 1078 |
|
| 1079 |
{hov_bgImgPos === "custom" && ( |
| 1080 |
<> |
| 1081 |
<UnitControl |
| 1082 |
selectedUnit={hov_bgImgcustomPosXUnit} |
| 1083 |
unitTypes={[ |
| 1084 |
{ label: "px", value: "px" }, |
| 1085 |
{ label: "em", value: "em" }, |
| 1086 |
{ label: "%", value: "%" }, |
| 1087 |
]} |
| 1088 |
onClick={(hov_bgImgcustomPosXUnit) => |
| 1089 |
setAttributes({ |
| 1090 |
[`hov_${controlName}bgImgcustomPosXUnit`]: |
| 1091 |
hov_bgImgcustomPosXUnit, |
| 1092 |
}) |
| 1093 |
} |
| 1094 |
/> |
| 1095 |
|
| 1096 |
<WithResButtons |
| 1097 |
resRequiredProps={resRequiredProps} |
| 1098 |
label="X Position" |
| 1099 |
> |
| 1100 |
<RangeControl |
| 1101 |
value={hov_bgImgcustomPosX} |
| 1102 |
min={0} |
| 1103 |
max={ |
| 1104 |
hov_bgImgcustomPosXUnit === "px" |
| 1105 |
? 2000 |
| 1106 |
: 100 |
| 1107 |
} |
| 1108 |
onChange={(hov_bgImgcustomPosX) => |
| 1109 |
setAttributes({ |
| 1110 |
[`hov_${controlName}bgImgcustomPosX`]: |
| 1111 |
hov_bgImgcustomPosX, |
| 1112 |
}) |
| 1113 |
} |
| 1114 |
/> |
| 1115 |
</WithResButtons> |
| 1116 |
|
| 1117 |
<UnitControl |
| 1118 |
selectedUnit={hov_bgImgcustomPosYUnit} |
| 1119 |
unitTypes={[ |
| 1120 |
{ label: "px", value: "px" }, |
| 1121 |
{ label: "em", value: "em" }, |
| 1122 |
{ label: "%", value: "%" }, |
| 1123 |
]} |
| 1124 |
onClick={(hov_bgImgcustomPosYUnit) => |
| 1125 |
setAttributes({ |
| 1126 |
[`hov_${controlName}bgImgcustomPosYUnit`]: |
| 1127 |
hov_bgImgcustomPosYUnit, |
| 1128 |
}) |
| 1129 |
} |
| 1130 |
/> |
| 1131 |
|
| 1132 |
<WithResButtons |
| 1133 |
resRequiredProps={resRequiredProps} |
| 1134 |
label="Y Position" |
| 1135 |
> |
| 1136 |
<RangeControl |
| 1137 |
value={hov_bgImgcustomPosY} |
| 1138 |
min={0} |
| 1139 |
max={ |
| 1140 |
hov_bgImgcustomPosYUnit === "px" |
| 1141 |
? 2000 |
| 1142 |
: 100 |
| 1143 |
} |
| 1144 |
step={ |
| 1145 |
hov_bgImgcustomPosYUnit === "px" ? 1 : 0.1 |
| 1146 |
} |
| 1147 |
onChange={(hov_bgImgcustomPosY) => |
| 1148 |
setAttributes({ |
| 1149 |
[`hov_${controlName}bgImgcustomPosY`]: |
| 1150 |
hov_bgImgcustomPosY, |
| 1151 |
}) |
| 1152 |
} |
| 1153 |
/> |
| 1154 |
</WithResButtons> |
| 1155 |
</> |
| 1156 |
)} |
| 1157 |
|
| 1158 |
<SelectControl |
| 1159 |
label="Attachment" |
| 1160 |
value={hov_bgImgAttachment} |
| 1161 |
options={[ |
| 1162 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1163 |
{ label: __("Scroll", "betterdocs"), value: "scroll" }, |
| 1164 |
{ label: __("Fixed", "betterdocs"), value: "fixed" }, |
| 1165 |
]} |
| 1166 |
onChange={(hov_bgImgAttachment) => |
| 1167 |
setAttributes({ |
| 1168 |
[`hov_${controlName}bgImgAttachment`]: |
| 1169 |
hov_bgImgAttachment, |
| 1170 |
}) |
| 1171 |
} |
| 1172 |
/> |
| 1173 |
|
| 1174 |
{hov_bgImgAttachment === "fixed" && ( |
| 1175 |
<p |
| 1176 |
style={{ |
| 1177 |
marginTop: "-10px", |
| 1178 |
paddingBottom: "10px", |
| 1179 |
}} |
| 1180 |
> |
| 1181 |
<i> |
| 1182 |
Note: Attachment Fixed works only on desktop. |
| 1183 |
</i> |
| 1184 |
</p> |
| 1185 |
)} |
| 1186 |
|
| 1187 |
<WithResButtons |
| 1188 |
resRequiredProps={resRequiredProps} |
| 1189 |
label="Repeat" |
| 1190 |
> |
| 1191 |
<SelectControl |
| 1192 |
value={hov_bgImgRepeat} |
| 1193 |
options={[ |
| 1194 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1195 |
{ label: __("No-repeat", "betterdocs"), value: "no-repeat" }, |
| 1196 |
{ label: __("Repeat", "betterdocs"), value: "repeat" }, |
| 1197 |
{ label: __("Repeat-x", "betterdocs"), value: "repeat-x" }, |
| 1198 |
{ label: __("Repeat-y", "betterdocs"), value: "repeat-y" }, |
| 1199 |
]} |
| 1200 |
onChange={(hov_bgImgRepeat) => |
| 1201 |
setAttributes({ |
| 1202 |
[`hov_${controlName}bgImgRepeat`]: |
| 1203 |
hov_bgImgRepeat, |
| 1204 |
}) |
| 1205 |
} |
| 1206 |
/> |
| 1207 |
</WithResButtons> |
| 1208 |
|
| 1209 |
<WithResButtons |
| 1210 |
resRequiredProps={resRequiredProps} |
| 1211 |
label="Size" |
| 1212 |
> |
| 1213 |
<SelectControl |
| 1214 |
value={hov_backgroundSize} |
| 1215 |
options={[ |
| 1216 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1217 |
{ label: __("Auto", "betterdocs"), value: "auto" }, |
| 1218 |
{ label: __("Cover", "betterdocs"), value: "cover" }, |
| 1219 |
{ label: __("Contain", "betterdocs"), value: "contain" }, |
| 1220 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 1221 |
]} |
| 1222 |
onChange={(hov_backgroundSize) => |
| 1223 |
setAttributes({ |
| 1224 |
[`hov_${controlName}backgroundSize`]: |
| 1225 |
hov_backgroundSize, |
| 1226 |
}) |
| 1227 |
} |
| 1228 |
/> |
| 1229 |
</WithResButtons> |
| 1230 |
|
| 1231 |
{hov_backgroundSize === "custom" && ( |
| 1232 |
<> |
| 1233 |
<UnitControl |
| 1234 |
selectedUnit={hov_bgImgCustomSizeUnit} |
| 1235 |
unitTypes={[ |
| 1236 |
{ label: "px", value: "px" }, |
| 1237 |
{ label: "em", value: "em" }, |
| 1238 |
{ label: "%", value: "%" }, |
| 1239 |
]} |
| 1240 |
onClick={(hov_bgImgCustomSizeUnit) => |
| 1241 |
setAttributes({ |
| 1242 |
[`hov_${controlName}bgImgCustomSizeUnit`]: |
| 1243 |
hov_bgImgCustomSizeUnit, |
| 1244 |
}) |
| 1245 |
} |
| 1246 |
/> |
| 1247 |
|
| 1248 |
<WithResButtons |
| 1249 |
resRequiredProps={resRequiredProps} |
| 1250 |
label="Width" |
| 1251 |
> |
| 1252 |
<RangeControl |
| 1253 |
value={hov_bgImgCustomSize} |
| 1254 |
min={0} |
| 1255 |
max={ |
| 1256 |
hov_bgImgCustomSizeUnit === "px" |
| 1257 |
? 2000 |
| 1258 |
: 100 |
| 1259 |
} |
| 1260 |
step={ |
| 1261 |
hov_bgImgCustomSizeUnit === "px" ? 1 : 0.1 |
| 1262 |
} |
| 1263 |
onChange={(hov_bgImgCustomSize) => |
| 1264 |
setAttributes({ |
| 1265 |
[`hov_${controlName}bgImgCustomSize`]: |
| 1266 |
hov_bgImgCustomSize, |
| 1267 |
}) |
| 1268 |
} |
| 1269 |
/> |
| 1270 |
</WithResButtons> |
| 1271 |
</> |
| 1272 |
)} |
| 1273 |
</> |
| 1274 |
)} |
| 1275 |
|
| 1276 |
{resOption === "Tablet" && ( |
| 1277 |
<> |
| 1278 |
<WithResButtons |
| 1279 |
resRequiredProps={resRequiredProps} |
| 1280 |
label="Position" |
| 1281 |
> |
| 1282 |
<SelectControl |
| 1283 |
value={hov_TABbgImgPos} |
| 1284 |
options={[ |
| 1285 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1286 |
{ |
| 1287 |
label: __("Center Center", "betterdocs"), |
| 1288 |
value: "center center", |
| 1289 |
}, |
| 1290 |
{ |
| 1291 |
label: __("Center Left", "betterdocs"), |
| 1292 |
value: "center left", |
| 1293 |
}, |
| 1294 |
{ |
| 1295 |
label: __("Center Right", "betterdocs"), |
| 1296 |
value: "center right", |
| 1297 |
}, |
| 1298 |
{ |
| 1299 |
label: __("Top Center", "betterdocs"), |
| 1300 |
value: "top center", |
| 1301 |
}, |
| 1302 |
{ label: __("Top Left", "betterdocs"), value: "top left" }, |
| 1303 |
{ label: __("Top Right", "betterdocs"), value: "top right" }, |
| 1304 |
{ |
| 1305 |
label: __("Bottom Center", "betterdocs"), |
| 1306 |
value: "bottom center", |
| 1307 |
}, |
| 1308 |
{ |
| 1309 |
label: __("Bottom Left", "betterdocs"), |
| 1310 |
value: "bottom left", |
| 1311 |
}, |
| 1312 |
{ |
| 1313 |
label: __("Bottom Right", "betterdocs"), |
| 1314 |
value: "bottom right", |
| 1315 |
}, |
| 1316 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 1317 |
]} |
| 1318 |
onChange={(hov_TABbgImgPos) => |
| 1319 |
setAttributes({ |
| 1320 |
[`hov_TAB${controlName}bgImgPos`]: |
| 1321 |
hov_TABbgImgPos, |
| 1322 |
}) |
| 1323 |
} |
| 1324 |
/> |
| 1325 |
</WithResButtons> |
| 1326 |
|
| 1327 |
{hov_TABbgImgPos === "custom" && ( |
| 1328 |
<> |
| 1329 |
<UnitControl |
| 1330 |
selectedUnit={hov_TABbgImgcustomPosXUnit} |
| 1331 |
unitTypes={[ |
| 1332 |
{ label: "px", value: "px" }, |
| 1333 |
{ label: "em", value: "em" }, |
| 1334 |
{ label: "%", value: "%" }, |
| 1335 |
]} |
| 1336 |
onClick={(hov_TABbgImgcustomPosXUnit) => |
| 1337 |
setAttributes({ |
| 1338 |
[`hov_TAB${controlName}bgImgcustomPosXUnit`]: |
| 1339 |
hov_TABbgImgcustomPosXUnit, |
| 1340 |
}) |
| 1341 |
} |
| 1342 |
/> |
| 1343 |
|
| 1344 |
<WithResButtons |
| 1345 |
resRequiredProps={resRequiredProps} |
| 1346 |
label="X Position" |
| 1347 |
> |
| 1348 |
<RangeControl |
| 1349 |
value={hov_TABbgImgcustomPosX} |
| 1350 |
min={0} |
| 1351 |
max={ |
| 1352 |
hov_TABbgImgcustomPosXUnit === "px" |
| 1353 |
? 2000 |
| 1354 |
: 100 |
| 1355 |
} |
| 1356 |
onChange={(hov_TABbgImgcustomPosX) => |
| 1357 |
setAttributes({ |
| 1358 |
[`hov_TAB${controlName}bgImgcustomPosX`]: |
| 1359 |
hov_TABbgImgcustomPosX, |
| 1360 |
}) |
| 1361 |
} |
| 1362 |
/> |
| 1363 |
</WithResButtons> |
| 1364 |
|
| 1365 |
<UnitControl |
| 1366 |
selectedUnit={hov_TABbgImgcustomPosYUnit} |
| 1367 |
unitTypes={[ |
| 1368 |
{ label: "px", value: "px" }, |
| 1369 |
{ label: "em", value: "em" }, |
| 1370 |
{ label: "%", value: "%" }, |
| 1371 |
]} |
| 1372 |
onClick={(hov_TABbgImgcustomPosYUnit) => |
| 1373 |
setAttributes({ |
| 1374 |
[`hov_TAB${controlName}bgImgcustomPosYUnit`]: |
| 1375 |
hov_TABbgImgcustomPosYUnit, |
| 1376 |
}) |
| 1377 |
} |
| 1378 |
/> |
| 1379 |
|
| 1380 |
<WithResButtons |
| 1381 |
resRequiredProps={resRequiredProps} |
| 1382 |
label="Y Position" |
| 1383 |
> |
| 1384 |
<RangeControl |
| 1385 |
value={hov_TABbgImgcustomPosY} |
| 1386 |
min={0} |
| 1387 |
max={ |
| 1388 |
hov_TABbgImgcustomPosYUnit === "px" |
| 1389 |
? 2000 |
| 1390 |
: 100 |
| 1391 |
} |
| 1392 |
step={ |
| 1393 |
hov_TABbgImgcustomPosYUnit === "px" |
| 1394 |
? 1 |
| 1395 |
: 0.1 |
| 1396 |
} |
| 1397 |
onChange={(hov_TABbgImgcustomPosY) => |
| 1398 |
setAttributes({ |
| 1399 |
[`hov_TAB${controlName}bgImgcustomPosY`]: |
| 1400 |
hov_TABbgImgcustomPosY, |
| 1401 |
}) |
| 1402 |
} |
| 1403 |
/> |
| 1404 |
</WithResButtons> |
| 1405 |
</> |
| 1406 |
)} |
| 1407 |
|
| 1408 |
<SelectControl |
| 1409 |
label="Attachment" |
| 1410 |
value={hov_bgImgAttachment} |
| 1411 |
options={[ |
| 1412 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1413 |
{ label: __("Scroll", "betterdocs"), value: "scroll" }, |
| 1414 |
{ label: __("Fixed", "betterdocs"), value: "fixed" }, |
| 1415 |
]} |
| 1416 |
onChange={(hov_bgImgAttachment) => |
| 1417 |
setAttributes({ |
| 1418 |
[`hov_${controlName}bgImgAttachment`]: |
| 1419 |
hov_bgImgAttachment, |
| 1420 |
}) |
| 1421 |
} |
| 1422 |
/> |
| 1423 |
|
| 1424 |
{hov_bgImgAttachment === "fixed" && ( |
| 1425 |
<p |
| 1426 |
style={{ |
| 1427 |
marginTop: "-10px", |
| 1428 |
paddingBottom: "10px", |
| 1429 |
}} |
| 1430 |
> |
| 1431 |
<i> |
| 1432 |
Note: Attachment Fixed works only on desktop. |
| 1433 |
</i> |
| 1434 |
</p> |
| 1435 |
)} |
| 1436 |
|
| 1437 |
<WithResButtons |
| 1438 |
resRequiredProps={resRequiredProps} |
| 1439 |
label="Repeat" |
| 1440 |
> |
| 1441 |
<SelectControl |
| 1442 |
value={hov_TABbgImgRepeat} |
| 1443 |
options={[ |
| 1444 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1445 |
{ label: __("No-repeat", "betterdocs"), value: "no-repeat" }, |
| 1446 |
{ label: __("Repeat", "betterdocs"), value: "repeat" }, |
| 1447 |
{ label: __("Repeat-x", "betterdocs"), value: "repeat-x" }, |
| 1448 |
{ label: __("Repeat-y", "betterdocs"), value: "repeat-y" }, |
| 1449 |
]} |
| 1450 |
onChange={(hov_TABbgImgRepeat) => |
| 1451 |
setAttributes({ |
| 1452 |
[`hov_TAB${controlName}bgImgRepeat`]: |
| 1453 |
hov_TABbgImgRepeat, |
| 1454 |
}) |
| 1455 |
} |
| 1456 |
/> |
| 1457 |
</WithResButtons> |
| 1458 |
|
| 1459 |
<WithResButtons |
| 1460 |
resRequiredProps={resRequiredProps} |
| 1461 |
label="Size" |
| 1462 |
> |
| 1463 |
<SelectControl |
| 1464 |
value={hov_TABbackgroundSize} |
| 1465 |
options={[ |
| 1466 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1467 |
{ label: __("Auto", "betterdocs"), value: "auto" }, |
| 1468 |
{ label: __("Cover", "betterdocs"), value: "cover" }, |
| 1469 |
{ label: __("Contain", "betterdocs"), value: "contain" }, |
| 1470 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 1471 |
]} |
| 1472 |
onChange={(hov_TABbackgroundSize) => |
| 1473 |
setAttributes({ |
| 1474 |
[`hov_TAB${controlName}backgroundSize`]: |
| 1475 |
hov_TABbackgroundSize, |
| 1476 |
}) |
| 1477 |
} |
| 1478 |
/> |
| 1479 |
</WithResButtons> |
| 1480 |
|
| 1481 |
{hov_TABbackgroundSize === "custom" && ( |
| 1482 |
<> |
| 1483 |
<UnitControl |
| 1484 |
selectedUnit={hov_TABbgImgCustomSizeUnit} |
| 1485 |
unitTypes={[ |
| 1486 |
{ label: "px", value: "px" }, |
| 1487 |
{ label: "em", value: "em" }, |
| 1488 |
{ label: "%", value: "%" }, |
| 1489 |
]} |
| 1490 |
onClick={(hov_TABbgImgCustomSizeUnit) => |
| 1491 |
setAttributes({ |
| 1492 |
[`hov_TAB${controlName}bgImgCustomSizeUnit`]: |
| 1493 |
hov_TABbgImgCustomSizeUnit, |
| 1494 |
}) |
| 1495 |
} |
| 1496 |
/> |
| 1497 |
|
| 1498 |
<WithResButtons |
| 1499 |
resRequiredProps={resRequiredProps} |
| 1500 |
label="Width" |
| 1501 |
> |
| 1502 |
<RangeControl |
| 1503 |
value={hov_TABbgImgCustomSize} |
| 1504 |
min={0} |
| 1505 |
max={ |
| 1506 |
hov_TABbgImgCustomSizeUnit === "px" |
| 1507 |
? 2000 |
| 1508 |
: 100 |
| 1509 |
} |
| 1510 |
step={ |
| 1511 |
hov_TABbgImgCustomSizeUnit === "px" |
| 1512 |
? 1 |
| 1513 |
: 0.1 |
| 1514 |
} |
| 1515 |
onChange={(hov_TABbgImgCustomSize) => |
| 1516 |
setAttributes({ |
| 1517 |
[`hov_TAB${controlName}bgImgCustomSize`]: |
| 1518 |
hov_TABbgImgCustomSize, |
| 1519 |
}) |
| 1520 |
} |
| 1521 |
/> |
| 1522 |
</WithResButtons> |
| 1523 |
</> |
| 1524 |
)} |
| 1525 |
</> |
| 1526 |
)} |
| 1527 |
|
| 1528 |
{resOption === "Mobile" && ( |
| 1529 |
<> |
| 1530 |
<WithResButtons |
| 1531 |
resRequiredProps={resRequiredProps} |
| 1532 |
label="Position" |
| 1533 |
> |
| 1534 |
<SelectControl |
| 1535 |
value={hov_MOBbgImgPos} |
| 1536 |
options={[ |
| 1537 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1538 |
{ |
| 1539 |
label: __("Center Center", "betterdocs"), |
| 1540 |
value: "center center", |
| 1541 |
}, |
| 1542 |
{ |
| 1543 |
label: __("Center Left", "betterdocs"), |
| 1544 |
value: "center left", |
| 1545 |
}, |
| 1546 |
{ |
| 1547 |
label: __("Center Right", "betterdocs"), |
| 1548 |
value: "center right", |
| 1549 |
}, |
| 1550 |
{ |
| 1551 |
label: __("Top Center", "betterdocs"), |
| 1552 |
value: "top center", |
| 1553 |
}, |
| 1554 |
{ label: __("Top Left", "betterdocs"), value: "top left" }, |
| 1555 |
{ label: __("Top Right", "betterdocs"), value: "top right" }, |
| 1556 |
{ |
| 1557 |
label: __("Bottom Center", "betterdocs"), |
| 1558 |
value: "bottom center", |
| 1559 |
}, |
| 1560 |
{ |
| 1561 |
label: __("Bottom Left", "betterdocs"), |
| 1562 |
value: "bottom left", |
| 1563 |
}, |
| 1564 |
{ |
| 1565 |
label: __("Bottom Right", "betterdocs"), |
| 1566 |
value: "bottom right", |
| 1567 |
}, |
| 1568 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 1569 |
]} |
| 1570 |
onChange={(hov_MOBbgImgPos) => |
| 1571 |
setAttributes({ |
| 1572 |
[`hov_MOB${controlName}bgImgPos`]: |
| 1573 |
hov_MOBbgImgPos, |
| 1574 |
}) |
| 1575 |
} |
| 1576 |
/> |
| 1577 |
</WithResButtons> |
| 1578 |
|
| 1579 |
{hov_MOBbgImgPos === "custom" && ( |
| 1580 |
<> |
| 1581 |
<UnitControl |
| 1582 |
selectedUnit={hov_MOBbgImgcustomPosXUnit} |
| 1583 |
unitTypes={[ |
| 1584 |
{ label: "px", value: "px" }, |
| 1585 |
{ label: "em", value: "em" }, |
| 1586 |
{ label: "%", value: "%" }, |
| 1587 |
]} |
| 1588 |
onClick={(hov_MOBbgImgcustomPosXUnit) => |
| 1589 |
setAttributes({ |
| 1590 |
[`hov_MOB${controlName}bgImgcustomPosXUnit`]: |
| 1591 |
hov_MOBbgImgcustomPosXUnit, |
| 1592 |
}) |
| 1593 |
} |
| 1594 |
/> |
| 1595 |
|
| 1596 |
<WithResButtons |
| 1597 |
resRequiredProps={resRequiredProps} |
| 1598 |
label="X Position" |
| 1599 |
> |
| 1600 |
<RangeControl |
| 1601 |
value={hov_MOBbgImgcustomPosX} |
| 1602 |
min={0} |
| 1603 |
max={ |
| 1604 |
hov_MOBbgImgcustomPosXUnit === "px" |
| 1605 |
? 2000 |
| 1606 |
: 100 |
| 1607 |
} |
| 1608 |
onChange={(hov_MOBbgImgcustomPosX) => |
| 1609 |
setAttributes({ |
| 1610 |
[`hov_MOB${controlName}bgImgcustomPosX`]: |
| 1611 |
hov_MOBbgImgcustomPosX, |
| 1612 |
}) |
| 1613 |
} |
| 1614 |
/> |
| 1615 |
</WithResButtons> |
| 1616 |
|
| 1617 |
<UnitControl |
| 1618 |
selectedUnit={hov_MOBbgImgcustomPosYUnit} |
| 1619 |
unitTypes={[ |
| 1620 |
{ label: "px", value: "px" }, |
| 1621 |
{ label: "em", value: "em" }, |
| 1622 |
{ label: "%", value: "%" }, |
| 1623 |
]} |
| 1624 |
onClick={(hov_MOBbgImgcustomPosYUnit) => |
| 1625 |
setAttributes({ |
| 1626 |
[`hov_MOB${controlName}bgImgcustomPosYUnit`]: |
| 1627 |
hov_MOBbgImgcustomPosYUnit, |
| 1628 |
}) |
| 1629 |
} |
| 1630 |
/> |
| 1631 |
|
| 1632 |
<WithResButtons |
| 1633 |
resRequiredProps={resRequiredProps} |
| 1634 |
label="Y Position" |
| 1635 |
> |
| 1636 |
<RangeControl |
| 1637 |
value={hov_MOBbgImgcustomPosY} |
| 1638 |
min={0} |
| 1639 |
max={ |
| 1640 |
hov_MOBbgImgcustomPosYUnit === "px" |
| 1641 |
? 2000 |
| 1642 |
: 100 |
| 1643 |
} |
| 1644 |
step={ |
| 1645 |
hov_MOBbgImgcustomPosYUnit === "px" |
| 1646 |
? 1 |
| 1647 |
: 0.1 |
| 1648 |
} |
| 1649 |
onChange={(hov_MOBbgImgcustomPosY) => |
| 1650 |
setAttributes({ |
| 1651 |
[`hov_MOB${controlName}bgImgcustomPosY`]: |
| 1652 |
hov_MOBbgImgcustomPosY, |
| 1653 |
}) |
| 1654 |
} |
| 1655 |
/> |
| 1656 |
</WithResButtons> |
| 1657 |
</> |
| 1658 |
)} |
| 1659 |
|
| 1660 |
<SelectControl |
| 1661 |
label="Attachment" |
| 1662 |
value={hov_bgImgAttachment} |
| 1663 |
options={[ |
| 1664 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1665 |
{ label: __("Scroll", "betterdocs"), value: "scroll" }, |
| 1666 |
{ label: __("Fixed", "betterdocs"), value: "fixed" }, |
| 1667 |
]} |
| 1668 |
onChange={(hov_bgImgAttachment) => |
| 1669 |
setAttributes({ |
| 1670 |
[`hov_${controlName}bgImgAttachment`]: |
| 1671 |
hov_bgImgAttachment, |
| 1672 |
}) |
| 1673 |
} |
| 1674 |
/> |
| 1675 |
|
| 1676 |
{hov_bgImgAttachment === "fixed" && ( |
| 1677 |
<p |
| 1678 |
style={{ |
| 1679 |
marginTop: "-10px", |
| 1680 |
paddingBottom: "10px", |
| 1681 |
}} |
| 1682 |
> |
| 1683 |
<i> |
| 1684 |
Note: Attachment Fixed works only on desktop. |
| 1685 |
</i> |
| 1686 |
</p> |
| 1687 |
)} |
| 1688 |
|
| 1689 |
<WithResButtons |
| 1690 |
resRequiredProps={resRequiredProps} |
| 1691 |
label="Repeat" |
| 1692 |
> |
| 1693 |
<SelectControl |
| 1694 |
value={hov_MOBbgImgRepeat} |
| 1695 |
options={[ |
| 1696 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1697 |
{ label: __("No-repeat", "betterdocs"), value: "no-repeat" }, |
| 1698 |
{ label: __("Repeat", "betterdocs"), value: "repeat" }, |
| 1699 |
{ label: __("Repeat-x", "betterdocs"), value: "repeat-x" }, |
| 1700 |
{ label: __("Repeat-y", "betterdocs"), value: "repeat-y" }, |
| 1701 |
]} |
| 1702 |
onChange={(hov_MOBbgImgRepeat) => |
| 1703 |
setAttributes({ |
| 1704 |
[`hov_MOB${controlName}bgImgRepeat`]: |
| 1705 |
hov_MOBbgImgRepeat, |
| 1706 |
}) |
| 1707 |
} |
| 1708 |
/> |
| 1709 |
</WithResButtons> |
| 1710 |
|
| 1711 |
<WithResButtons |
| 1712 |
resRequiredProps={resRequiredProps} |
| 1713 |
label="Size" |
| 1714 |
> |
| 1715 |
<SelectControl |
| 1716 |
value={hov_MOBbackgroundSize} |
| 1717 |
options={[ |
| 1718 |
{ label: __("Default", "betterdocs"), value: "" }, |
| 1719 |
{ label: __("Auto", "betterdocs"), value: "auto" }, |
| 1720 |
{ label: __("Cover", "betterdocs"), value: "cover" }, |
| 1721 |
{ label: __("Contain", "betterdocs"), value: "contain" }, |
| 1722 |
{ label: __("Custom", "betterdocs"), value: "custom" }, |
| 1723 |
]} |
| 1724 |
onChange={(hov_MOBbackgroundSize) => |
| 1725 |
setAttributes({ |
| 1726 |
[`hov_MOB${controlName}backgroundSize`]: |
| 1727 |
hov_MOBbackgroundSize, |
| 1728 |
}) |
| 1729 |
} |
| 1730 |
/> |
| 1731 |
</WithResButtons> |
| 1732 |
|
| 1733 |
{hov_MOBbackgroundSize === "custom" && ( |
| 1734 |
<> |
| 1735 |
<UnitControl |
| 1736 |
selectedUnit={hov_MOBbgImgCustomSizeUnit} |
| 1737 |
unitTypes={[ |
| 1738 |
{ label: "px", value: "px" }, |
| 1739 |
{ label: "em", value: "em" }, |
| 1740 |
{ label: "%", value: "%" }, |
| 1741 |
]} |
| 1742 |
onClick={(hov_MOBbgImgCustomSizeUnit) => |
| 1743 |
setAttributes({ |
| 1744 |
[`hov_MOB${controlName}bgImgCustomSizeUnit`]: |
| 1745 |
hov_MOBbgImgCustomSizeUnit, |
| 1746 |
}) |
| 1747 |
} |
| 1748 |
/> |
| 1749 |
|
| 1750 |
<WithResButtons |
| 1751 |
resRequiredProps={resRequiredProps} |
| 1752 |
label="Width" |
| 1753 |
> |
| 1754 |
<RangeControl |
| 1755 |
value={hov_MOBbgImgCustomSize} |
| 1756 |
min={0} |
| 1757 |
max={ |
| 1758 |
hov_MOBbgImgCustomSizeUnit === "px" |
| 1759 |
? 2000 |
| 1760 |
: 100 |
| 1761 |
} |
| 1762 |
step={ |
| 1763 |
hov_MOBbgImgCustomSizeUnit === "px" |
| 1764 |
? 1 |
| 1765 |
: 0.1 |
| 1766 |
} |
| 1767 |
onChange={(hov_MOBbgImgCustomSize) => |
| 1768 |
setAttributes({ |
| 1769 |
[`hov_MOB${controlName}bgImgCustomSize`]: |
| 1770 |
hov_MOBbgImgCustomSize, |
| 1771 |
}) |
| 1772 |
} |
| 1773 |
/> |
| 1774 |
</WithResButtons> |
| 1775 |
</> |
| 1776 |
)} |
| 1777 |
</> |
| 1778 |
)} |
| 1779 |
</> |
| 1780 |
)} |
| 1781 |
</> |
| 1782 |
)} |
| 1783 |
</> |
| 1784 |
)} |
| 1785 |
|
| 1786 |
{hov_backgroundType === "gradient" && ( |
| 1787 |
<GradientColorControl |
| 1788 |
gradientColor={hov_gradientColor} |
| 1789 |
onChange={(hov_gradientColor) => |
| 1790 |
setAttributes({ |
| 1791 |
[`hov_${controlName}gradientColor`]: hov_gradientColor, |
| 1792 |
}) |
| 1793 |
} |
| 1794 |
/> |
| 1795 |
)} |
| 1796 |
{!noTransition && ( |
| 1797 |
<RangeControl |
| 1798 |
label={__("Background Transition", "betterdocs")} |
| 1799 |
value={bg_transition} |
| 1800 |
min={0} |
| 1801 |
max={5} |
| 1802 |
step={0.1} |
| 1803 |
onChange={(bg_transition) => |
| 1804 |
setAttributes({ |
| 1805 |
[`${controlName}bg_transition`]: bg_transition, |
| 1806 |
}) |
| 1807 |
} |
| 1808 |
/> |
| 1809 |
)} |
| 1810 |
</> |
| 1811 |
)} |
| 1812 |
</> |
| 1813 |
); |
| 1814 |
} |
| 1815 |
|