import { __ } from "@wordpress/i18n"; import { Background, Border, BoxShadow, Divider, Spacing, SpColorPicker, SPRangeControl, SPToggleGroupControl, Toggle, TypographyNew, } from "../../components"; import { Fragment, useState } from "@wordpress/element"; import { BgIcon, GradientIcon, TransparentIcon } from "../../components/background/svgIcon"; export const PresetStyleTab = ({ attributes, setAttributes }) => { const { inputPlaceholderTypography, inputPlaceholderFontSize, inputPlaceholderLatterSpacing, inputPlaceholderWordSpacing, inputPlaceholderLineHeight, inputPlaceholderColor, searchFormBgColor, searchFormBorder, searchFormBorderWidth, searchFormHoverBorder, searchFormHoverBorderWidth, searchFormBorderRadius, searchFormHoverBorderRadius, searchFormPadding, searchFormWidth, searchFormHeight, inputPlaceHolderGlobalTypography, } = attributes; const [colorState, setColorState] = useState("color"); return ( <> setColorState(newValue)} items={[ { label: "Normal", value: "color" }, { label: "Hover & Focus", value: "hover" }, ]} /> , value: "bgColor", tooltip: "Solid", }, { label: , value: "gradient", tooltip: "Gradient", }, ]} /> {"color" === colorState ? ( setAttributes({ inputPlaceholderColor: { ...inputPlaceholderColor, color: newValue, }, }) } /> ) : ( setAttributes({ inputPlaceholderColor: { ...inputPlaceholderColor, hoverColor: newValue, }, }) } /> )} ); }; export const SearchButtonStyleTab = ({ attributes, setAttributes }) => { const { searchButtonIconColor, searchIcon, searchIconDivider, searchBtnLabelTextColor, searchBtnLabel, searchBtnBgColor, searchFormPreset, searchButtonBorderRadius, searchButtonBorder, searchButtonBorderWidth, searchButtonPadding, gapWithIcon, gapWithSearchField, searchBtnLabelTypography, searchBtnLabelFontSize, searchIconDividerColor, searchBtnLabelLineHeight, searchButtonHoverBorder, searchButtonHoverBorderWidth, } = attributes; const [colorState, setColorState] = useState("color"); return ( <> {searchBtnLabel && [ "smart-search-form-preset-three", "smart-search-form-preset-four", "smart-search-form-preset-five", ].includes(searchFormPreset) && ( )} setColorState(newValue)} items={[ { label: "Normal", value: "color" }, { label: "Hover", value: "hoverColor" }, ]} /> {searchIcon && ( setAttributes({ searchButtonIconColor: { ...searchButtonIconColor, [colorState]: newValue, }, }) } /> )} {searchIconDivider && "smart-search-form-preset-one" === searchFormPreset && ( setAttributes({ searchIconDividerColor: { ...searchIconDividerColor, [colorState]: newValue, }, }) } /> )} {[ "smart-search-form-preset-three", "smart-search-form-preset-four", "smart-search-form-preset-five", ].includes(searchFormPreset) && ( <> {searchBtnLabel && ( setAttributes({ searchBtnLabelTextColor: { ...searchBtnLabelTextColor, [colorState]: newValue, }, }) } /> )} , value: "transparent", tooltip: "Transparent", }, { label: , value: "bgColor", tooltip: "Solid", }, { label: , value: "gradient", tooltip: "Gradient", }, ]} /> {colorState === "color" ? ( ) : ( )} {searchIcon && searchBtnLabel && ( )} {"smart-search-form-preset-four" === searchFormPreset && ( )} )} ); }; export const SearchResultStyleTab = ({ attributes, setAttributes }) => { const { searchResultTitleTypography, searchResultTitleFontSize, searchResultTitleLineHeight, searchResultMetaTypography, searchResultMetaFontSize, searchResultMetaLineHeight, searchResultTitleColor, searchResultMetaColor, searchResultHighlightColor, searchResultItemSeparatorColor, searchResultBoxBackground, searchResultBoxBorder, searchResultHoverBoxBorder, searchResultBoxBorderWidth, searchResultHoverBoxBorderWidth, searchResultBoxBorderRadius, searchResultBoxHoverBorderRadius, searchResultBoxPadding, searchResultImgBorderRadius, searchResultTitleGlobalTypography, searchResultMetaGlobalTypography, } = attributes; const [colorState, setColorState] = useState("color"); return ( <> setColorState(newValue)} items={[ { label: "Normal", value: "color" }, { label: "Hover", value: "hoverColor" }, ]} /> setAttributes({ searchResultTitleColor: { ...searchResultTitleColor, [colorState]: newValue, }, }) } /> setAttributes({ searchResultMetaColor: { ...searchResultMetaColor, [colorState]: newValue, }, }) } /> setAttributes({ searchResultHighlightColor: { ...searchResultHighlightColor, [colorState]: newValue, }, }) } /> setAttributes({ searchResultItemSeparatorColor: { ...searchResultItemSeparatorColor, [colorState]: newValue, }, }) } /> , value: "bgColor", tooltip: "Solid", }, { label: , value: "gradient", tooltip: "Gradient", }, ]} /> {colorState === "color" ? ( <> ) : ( <> )} ); }; export const MoreResultStyleTab = ({ attributes, setAttributes }) => { const { moreResultTypography, moreResultFontSize, moreResultLineHeight, moreResultGlobalTypography, moreResultColor, moreResultLatterSpacing, moreResultWordSpacing, } = attributes; const [colorState, setColorState] = useState("color"); return ( <> setColorState(newValue)} items={[ { label: "Normal", value: "color" }, { label: "Hover", value: "hoverColor" }, ]} /> setAttributes({ moreResultColor: { ...moreResultColor, [colorState]: newValue, }, }) } /> ); }; export const PopupCanvasStyleTab = ({ attributes, setAttributes }) => { const { popupHeadingTypography, popupHeadingFontSize, popupCloseIconColor, popupHeadingLineHeight, popupCanvasBorder, popupHeadingLatterSpacing, popupHeadingWordSpacing, popupHeadingGlobalTypography, popupHeadingColor, popupCanvasBgColor, popupCanvasBorderWidth, popupCanvasHoverBorder, popupCanvasHoverBorderWidth, popupCanvasBorderRadius, popupCanvasPadding, popupCanvasBoxShadowEnable, popupCanvasBoxShadowValue, popupCanvasMargin, } = attributes; const [colorState, setColorState] = useState("color"); return ( <> setColorState(newValue)} items={[ { label: "Normal", value: "color" }, { label: "Hover", value: "hoverColor" }, ]} /> setAttributes({ popupHeadingColor: { ...popupHeadingColor, [colorState]: newValue, }, }) } /> setAttributes({ popupCloseIconColor: { ...popupCloseIconColor, [colorState]: newValue, }, }) } /> , value: "transparent", tooltip: "Transparent", }, { label: , value: "bgColor", tooltip: "Solid", }, { label: , value: "gradient", tooltip: "Gradient", }, ]} /> {colorState === "color" ? ( <> ) : ( <> )} {popupCanvasBoxShadowEnable && ( <> )} ); };