diff --git a/webapp/IronCalc/src/components/colorPicker.tsx b/webapp/IronCalc/src/components/ColorPicker.tsx similarity index 86% rename from webapp/IronCalc/src/components/colorPicker.tsx rename to webapp/IronCalc/src/components/ColorPicker.tsx index 026790a..d466bd5 100644 --- a/webapp/IronCalc/src/components/colorPicker.tsx +++ b/webapp/IronCalc/src/components/ColorPicker.tsx @@ -1,12 +1,13 @@ import styled from "@emotion/styled"; import Popover, { type PopoverOrigin } from "@mui/material/Popover"; +import { Check } from "lucide-react"; import type React from "react"; import { useEffect, useRef, useState } from "react"; import { HexColorInput, HexColorPicker } from "react-colorful"; +import { useTranslation } from "react-i18next"; import { theme } from "../theme"; type ColorPickerProps = { - className?: string; color: string; onChange: (color: string) => void; onClose: () => void; @@ -17,17 +18,19 @@ type ColorPickerProps = { }; const colorPickerWidth = 240; -const colorfulHeight = 185; // 150 + 15 + 20 +const colorfulHeight = 240; const ColorPicker = (properties: ColorPickerProps) => { const [color, setColor] = useState(properties.color); const recentColors = useRef([]); + const { t } = useTranslation(); + const closePicker = (newColor: string): void => { const maxRecentColors = 14; - properties.onChange(newColor); const colors = recentColors.current.filter((c) => c !== newColor); recentColors.current = [newColor, ...colors].slice(0, maxRecentColors); + properties.onChange(newColor); }; const handleClose = (): void => { @@ -85,21 +88,16 @@ const ColorPicker = (properties: ColorPickerProps) => { /> - { - closePicker(color); - }} - /> + {presetColors.map((presetColor) => ( -