FIX: Add 'title' to ColorPicker
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
03ad87cd8f
commit
9e65ea3024
@@ -262,6 +262,7 @@ const BorderPicker = (properties: BorderPickerProps) => {
|
|||||||
</BorderPickerDialog>
|
</BorderPickerDialog>
|
||||||
<ColorPicker
|
<ColorPicker
|
||||||
color={borderColor}
|
color={borderColor}
|
||||||
|
title={t("color_picker.no_fill")}
|
||||||
onChange={(color): void => {
|
onChange={(color): void => {
|
||||||
setBorderColor(color);
|
setBorderColor(color);
|
||||||
setColorPickerOpen(false);
|
setColorPickerOpen(false);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { theme } from "../../theme";
|
|||||||
// Types
|
// Types
|
||||||
type ColorPickerProps = {
|
type ColorPickerProps = {
|
||||||
color: string;
|
color: string;
|
||||||
|
title: string;
|
||||||
onChange: (color: string) => void;
|
onChange: (color: string) => void;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
anchorEl: React.RefObject<HTMLElement | null>;
|
anchorEl: React.RefObject<HTMLElement | null>;
|
||||||
@@ -22,6 +23,7 @@ const colorPickerWidth = 240;
|
|||||||
// Main Component
|
// Main Component
|
||||||
const ColorPicker = ({
|
const ColorPicker = ({
|
||||||
color,
|
color,
|
||||||
|
title,
|
||||||
onChange,
|
onChange,
|
||||||
onClose,
|
onClose,
|
||||||
anchorEl,
|
anchorEl,
|
||||||
@@ -177,7 +179,7 @@ const ColorPicker = ({
|
|||||||
>
|
>
|
||||||
<MenuItemWrapper onClick={() => handleColorSelect(color)}>
|
<MenuItemWrapper onClick={() => handleColorSelect(color)}>
|
||||||
<MenuItemSquare style={{ backgroundColor: color }} />
|
<MenuItemSquare style={{ backgroundColor: color }} />
|
||||||
<MenuItemText>{t("color_picker.default")}</MenuItemText>
|
<MenuItemText>{title}</MenuItemText>
|
||||||
</MenuItemWrapper>
|
</MenuItemWrapper>
|
||||||
<HorizontalDivider />
|
<HorizontalDivider />
|
||||||
<ColorsWrapper>
|
<ColorsWrapper>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Button, Menu, MenuItem, styled } from "@mui/material";
|
|||||||
import type { MenuItemProps } from "@mui/material";
|
import type { MenuItemProps } from "@mui/material";
|
||||||
import { ChevronDown } from "lucide-react";
|
import { ChevronDown } from "lucide-react";
|
||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { theme } from "../../theme";
|
import { theme } from "../../theme";
|
||||||
import ColorPicker from "../ColorPicker/ColorPicker";
|
import ColorPicker from "../ColorPicker/ColorPicker";
|
||||||
import { isInReferenceMode } from "../Editor/util";
|
import { isInReferenceMode } from "../Editor/util";
|
||||||
@@ -28,6 +29,7 @@ function SheetTab(props: SheetTabProps) {
|
|||||||
const [colorPickerOpen, setColorPickerOpen] = useState(false);
|
const [colorPickerOpen, setColorPickerOpen] = useState(false);
|
||||||
const colorButton = useRef<HTMLDivElement>(null);
|
const colorButton = useRef<HTMLDivElement>(null);
|
||||||
const open = Boolean(anchorEl);
|
const open = Boolean(anchorEl);
|
||||||
|
const { t } = useTranslation();
|
||||||
const handleOpen = (event: React.MouseEvent<HTMLButtonElement>) => {
|
const handleOpen = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
setAnchorEl(event.currentTarget);
|
setAnchorEl(event.currentTarget);
|
||||||
};
|
};
|
||||||
@@ -136,6 +138,7 @@ function SheetTab(props: SheetTabProps) {
|
|||||||
/>
|
/>
|
||||||
<ColorPicker
|
<ColorPicker
|
||||||
color={color}
|
color={color}
|
||||||
|
title={t("color_picker.no_fill")}
|
||||||
onChange={(color): void => {
|
onChange={(color): void => {
|
||||||
props.onColorChanged(color);
|
props.onColorChanged(color);
|
||||||
setColorPickerOpen(false);
|
setColorPickerOpen(false);
|
||||||
|
|||||||
@@ -443,6 +443,7 @@ function Toolbar(properties: ToolbarProperties) {
|
|||||||
|
|
||||||
<ColorPicker
|
<ColorPicker
|
||||||
color={properties.fontColor}
|
color={properties.fontColor}
|
||||||
|
title={t("color_picker.default")}
|
||||||
onChange={(color): void => {
|
onChange={(color): void => {
|
||||||
properties.onTextColorPicked(color);
|
properties.onTextColorPicked(color);
|
||||||
setFontColorPickerOpen(false);
|
setFontColorPickerOpen(false);
|
||||||
@@ -455,6 +456,7 @@ function Toolbar(properties: ToolbarProperties) {
|
|||||||
/>
|
/>
|
||||||
<ColorPicker
|
<ColorPicker
|
||||||
color={properties.fillColor}
|
color={properties.fillColor}
|
||||||
|
title={t("color_picker.default")}
|
||||||
onChange={(color): void => {
|
onChange={(color): void => {
|
||||||
if (color !== null) {
|
if (color !== null) {
|
||||||
properties.onFillColorPicked(color);
|
properties.onFillColorPicked(color);
|
||||||
|
|||||||
Reference in New Issue
Block a user