diff --git a/frontend/src/AppBuilder/CodeBuilder/Elements/Color.jsx b/frontend/src/AppBuilder/CodeBuilder/Elements/Color.jsx index e37b545ef2..691e299d45 100644 --- a/frontend/src/AppBuilder/CodeBuilder/Elements/Color.jsx +++ b/frontend/src/AppBuilder/CodeBuilder/Elements/Color.jsx @@ -15,6 +15,9 @@ export const Color = ({ outerWidth = '142px', component, styleDefinition, + componentType = 'color', + CustomOptionList = () => {}, + SwatchesToggle = () => {}, }) => { value = component == 'Button' ? computeColor(styleDefinition, value, meta) : value; const [showPicker, setShowPicker] = useState(false); @@ -68,9 +71,11 @@ export const Color = ({ const ColorPicker = () => { return ( <> - {showPicker && ( + {SwatchesToggle()} + {showPicker && componentType === 'swatches' && CustomOptionList()} + {showPicker && componentType === 'color' && (
-
setShowPicker(false)} /> + {/*
setShowPicker(false)} /> */}
setShowPicker(true)} diff --git a/frontend/src/AppBuilder/CodeBuilder/Elements/ColorSwatches.jsx b/frontend/src/AppBuilder/CodeBuilder/Elements/ColorSwatches.jsx new file mode 100644 index 0000000000..17bc178862 --- /dev/null +++ b/frontend/src/AppBuilder/CodeBuilder/Elements/ColorSwatches.jsx @@ -0,0 +1,82 @@ +import React, { useState } from 'react'; +import ToggleGroup from '@/ToolJetUI/SwitchGroup/ToggleGroup'; +import ToggleGroupItem from '@/ToolJetUI/SwitchGroup/ToggleGroupItem'; +import cx from 'classnames'; +import { Color } from './Color'; +import CheckIcon from '@/components/ui/Checkbox/CheckboxUtils/CheckIcon'; + +export const ColorSwatches = ({ + value, + onChange, + pickerStyle = {}, + cyLabel, + asBoxShadowPopover = true, + meta, + outerWidth = '142px', + component, + styleDefinition, +}) => { + const [componentType, setComponentType] = useState('color'); + + return ( + ( + <> + + + )} + CustomOptionList={() => ( +
+ + + + +
+ )} + /> + ); +}; + +const SwatchesToggle = ({ value, onChange }) => { + return ( +
+
+ { + onChange(value); + }} + defaultValue={value} + > + + Swatches + + + Color picker + + +
+
+ ); +}; + +const CustomOption = () => { + return ( +
+
+ +
+ Test +
+
+ ); +}; diff --git a/frontend/src/AppBuilder/CodeEditor/DynamicFxTypeRenderer.jsx b/frontend/src/AppBuilder/CodeEditor/DynamicFxTypeRenderer.jsx index 20b196476d..2e2d17d4af 100644 --- a/frontend/src/AppBuilder/CodeEditor/DynamicFxTypeRenderer.jsx +++ b/frontend/src/AppBuilder/CodeEditor/DynamicFxTypeRenderer.jsx @@ -18,9 +18,11 @@ import { NumberInput } from '../CodeBuilder/Elements/NumberInput'; import { Datepicker } from '../CodeBuilder/Elements/Datepicker'; import TableRowHeightInput from '../CodeBuilder/Elements/TableRowHeightInput'; import { TimePicker } from '../CodeBuilder/Elements/TimePicker'; +import { ColorSwatches } from '../CodeBuilder/Elements/ColorSwatches'; const AllElements = { Color, + ColorSwatches, Json, Toggle, Select, diff --git a/frontend/src/AppBuilder/CodeEditor/utils.js b/frontend/src/AppBuilder/CodeEditor/utils.js index 03473a629f..73d11e6f62 100644 --- a/frontend/src/AppBuilder/CodeEditor/utils.js +++ b/frontend/src/AppBuilder/CodeEditor/utils.js @@ -337,6 +337,7 @@ export const FxParamTypeMapping = Object.freeze({ color: 'Color', json: 'Json', code: 'Code', + colorSwatches: 'ColorSwatches', toggle: 'Toggle', select: 'Select', alignButtons: 'AlignButtons', diff --git a/frontend/src/AppBuilder/LeftSidebar/GlobalSettings/ThemeSelect.jsx b/frontend/src/AppBuilder/LeftSidebar/GlobalSettings/ThemeSelect.jsx new file mode 100644 index 0000000000..74817c21c6 --- /dev/null +++ b/frontend/src/AppBuilder/LeftSidebar/GlobalSettings/ThemeSelect.jsx @@ -0,0 +1,131 @@ +import React from 'react'; +import Select from '@/_ui/Select'; +import CheckMark from '@/_ui/Icon/bulkIcons/CheckMark'; +import { components } from 'react-select'; +import { ButtonSolid } from '@/_ui/AppButton/AppButton'; + +const ThemeSelect = ({ darkMode }) => { + const customSelectStyles = { + control: (provided) => ({ + ...provided, + width: '158px', + height: '32px', + minHeight: '32px', + }), + input: (provided) => ({ + ...provided, + width: '150px', + height: 'auto', + padding: '0px', + }), + valueContainer: (provided, _state) => ({ + ...provided, + fontSize: '12px', + height: '100%', + }), + menu: (provided) => ({ + ...provided, + width: '220px', + right: '0', + left: 'auto', + }), + menuList: (provided) => ({ + ...provided, + width: '220px', + textAlign: 'left', + overflowY: 'auto', // Enable scrolling if needed + scrollbarWidth: 'none', // Hide scrollbar for Firefox + borderRadius: '8px', + }), + option: (provided, state) => ({ + ...provided, + backgroundColor: state.isFocused + ? '#f0f0f0' // Hover color + : state.isSelected + ? '#e6e6e6' // Selected background color + : 'white', + color: state.isSelected ? '#333' : 'black', // Adjust text color for selected state + padding: '0px', + paddingLeft: '20px', + + position: 'relative', + }), + }; + + const CustomOption = (props) => { + const { data, isSelected } = props; + + return ( + +
+ {isSelected && ( + + )} +
+ {data.label} +
+ + ); + }; + + const CustomMenuList = (props) => { + return ( + +
+ On your workspace +
+ {props.children} +
+ {}} + variant="tertiary" + leftIcon="addrectangle" + fill="var(--primary-brand)" + iconWidth="16" + className="tj-text-xsm theme-create-btn" + > + Create a new theme + +
+
+ ); + }; + + return ( +
+
+

Theme

+
+