import { __ } from "@wordpress/i18n"; import { Border, Spacing, SpColorPicker, SPRangeControl, SPToggleGroupControl, Toggle, TypographyNew, } from "../../components"; import { useState } from "@wordpress/element"; export const StyleTab = ({ attributes, setAttributes }) => { const { titleTypography, titleFontSize, titleLatterSpacing, titleLineHeight, titleWordSpacing, optionTypography, optionFontSize, optionLatterSpacing, optionLineHeight, optionWordSpacing, titleColor, optionColor, iconColor, bgColor, borderNormal, borderHover, borderWidthNormal, borderWidthHover, borderRadiusNormal, borderRadiusHover, padding, margin, titleGlobalTypography, optionGlobalTypography, layout, activeBottomLine, menuTypography, menuFontSize, menuLatterSpacing, menuLineHeight, menuWordSpacing, menuGlobalTypography, menuColor, } = attributes; const [colorType, setColorType] = useState("normal"); return ( <> {"layoutTwo" === layout ? ( <> setColorType(newValue)} items={[ { label: "Normal", value: "normal", }, { label: "Hover & Active", value: "hover", }, ]} /> {"normal" === colorType && ( <> setAttributes({ menuColor: { ...menuColor, color: newColor, }, }) } defaultColor="#4E4F52" /> )} {"hover" === colorType && ( <> setAttributes({ menuColor: { ...menuColor, hover: newColor, }, }) } defaultColor="#4E4F52" /> )} ) : ( <> setAttributes({ titleColor: { ...titleColor, color: newColor }, }) } defaultColor="#4E4F52" /> setColorType(newValue)} items={[ { label: "Normal", value: "normal", }, { label: "Hover & Active", value: "hover", }, ]} /> {"normal" === colorType && ( <> setAttributes({ optionColor: { ...optionColor, color: newColor, }, }) } defaultColor="#4E4F52" /> setAttributes({ bgColor: { ...bgColor, color: newColor, }, }) } defaultColor="#ffffff" /> )} {"hover" === colorType && ( <> setAttributes({ optionColor: { ...optionColor, hover: newColor, }, }) } defaultColor="#4E4F52" /> setAttributes({ bgColor: { ...bgColor, hover: newColor, }, }) } defaultColor="#4E4F52" /> {/* */} )} )} ); }; export const HeadingStyle = ({ attributes, setAttributes }) => { const { headingTypography, headingLineHeight, headingWordSpacing, headingLatterSpacing, headingFontSize, headingGlobalTypography, headingColor, widthLineThickness, headingBg, headingBorder, headingBorderWidth, headingBorderRadius, headingPadding, widthLineColor, } = attributes; const [colorType, setColorType] = useState("normal"); return ( <> setColorType(newValue)} items={[ { label: "Normal", value: "normal", }, { label: "Hover & Active", value: "hover", }, ]} /> {"normal" === colorType && ( <> setAttributes({ headingColor: { ...headingColor, color: newColor, }, }) } defaultColor="#4E4F52" /> setAttributes({ widthLineColor: newColor, }) } defaultColor="#4E4F52" /> setAttributes({ headingBg: { ...headingBg, color: newColor, }, }) } defaultColor="#F05D31" /> )} {"hover" === colorType && ( <> setAttributes({ headingColor: { ...headingColor, hover: newColor, }, }) } defaultColor="#4E4F52" /> setAttributes({ headingBg: { ...headingBg, hover: newColor, }, }) } defaultColor="" /> )} ); };