import { __ } from "@wordpress/i18n"; import { Border, BoxShadow, Divider, InputControl, Spacing, SpColorPicker, SPRangeControl, SPToggleGroupControl, } from "../../components"; import Toggle from "../../components/toggle/toggle"; import { useState } from "@wordpress/element"; const FieldStyle = ({ attributes, setAttributes }) => { const { fieldLabelColor, fieldPadding, fieldBorder, fieldBorderWidth, fieldBorderRadius } = attributes; return ( <> setAttributes({ fieldLabelColor: newColor, }) } defaultColor="#333333" /> ); }; const DropdownStyle = ({ attributes, setAttributes }) => { const [colorType, setColorType] = useState("normal"); const { dropdownOptionColor, dropdownOptionBg, dropdownOptionBorder, dropdownOptionBorderHover, dropdownOptionBorderWidth, dropdownOptionBorderWidthHover, dropdownBorderRadius, dropdownBorderRadiusHover, dropdownAlignment, dropdownShadowEnable, dropdownShadow, dropdownShadowHover, dropdownShadowEnableHover, dropdownHoverColor, dropdownHoverBgColor, dropdownPadding, dropdownMargin, } = attributes; return ( <> setColorType(newValue)} items={[ { label: __("Normal", "post-carousel"), value: "normal", }, { label: __("Hover & Active", "post-carousel"), value: "hover", }, ]} /> {"normal" === colorType && ( <> setAttributes({ dropdownOptionColor: { ...dropdownOptionColor, color: newColor, }, }) } defaultColor="#333333" /> setAttributes({ dropdownOptionBg: { ...dropdownOptionBg, color: newColor, }, }) } defaultColor="#ffffff" /> )} {"hover" === colorType && ( <> setAttributes({ dropdownOptionColor: { ...dropdownOptionColor, hover: newColor, }, }) } defaultColor="#ffffff" /> setAttributes({ dropdownOptionBg: { ...dropdownOptionBg, hover: newColor, }, }) } defaultColor="var(--sp-smart-primary-2-600)" /> )} {dropdownShadowEnable && ( )} ); }; const SearchStyle = ({ attributes, setAttributes }) => { const { searchPlaceholderText, searchBorder, searchBorderWidth } = attributes; return ( <> {/* */} ); }; const StyleTab = ({ attributes, setAttributes }) => { const [fieldType, setFieldType] = useState("field"); const [colorType, setColorType] = useState("normal"); const { searchInDropdown, buttonColor, buttonBg, buttonBorder, buttonBorderWidth, buttonBorderRadius, buttonBorderHover, buttonBorderWidthHover, buttonBorderRadiusHover, buttonPadding, filterType, buttonGap, } = attributes; const fieldItemsList = [ { label: __("Field", "post-carousel"), value: "field" }, { label: __("Dropdown", "post-carousel"), value: "dropdown" }, ]; if (searchInDropdown) { fieldItemsList.push({ label: __("Search", "post-carousel"), value: "search", }); } return ( <> {"dropdown" === filterType && ( <> setFieldType(newValue)} setAttributes={setAttributes} items={fieldItemsList} /> {"field" === fieldType && } {"dropdown" === fieldType && ( )} {"search" === fieldType && } )} {"button" === filterType && ( <> setColorType(newValue)} items={[ { label: __("Normal", "post-carousel"), value: "normal", }, { label: __("Hover & Active", "post-carousel"), value: "hover", }, ]} /> {"normal" === colorType && ( <> setAttributes({ buttonColor: { ...buttonColor, color: newColor, }, }) } defaultColor="#333333" /> setAttributes({ buttonBg: { ...buttonBg, color: newColor, }, }) } defaultColor="var(--sp-smart-primary-2-600)" /> )} {"hover" === colorType && ( <> setAttributes({ buttonColor: { ...buttonColor, hover: newColor, }, }) } defaultColor="#ffffff" /> setAttributes({ buttonBg: { ...buttonBg, hover: newColor, }, }) } defaultColor="var(--sp-smart-primary-2-600)" /> )} )} ); }; export default StyleTab;