FIX: Add defaultColor to color picker

NB: Dani will have to pass the color from the theme
This commit is contained in:
Nicolás Hatcher
2025-03-18 23:22:44 +01:00
committed by Nicolás Hatcher Andrés
parent 9e65ea3024
commit 475c3e9d49
4 changed files with 9 additions and 3 deletions

View File

@@ -262,7 +262,8 @@ const BorderPicker = (properties: BorderPickerProps) => {
</BorderPickerDialog> </BorderPickerDialog>
<ColorPicker <ColorPicker
color={borderColor} color={borderColor}
title={t("color_picker.no_fill")} defaultColor="#000000"
title={t("color_picker.default")}
onChange={(color): void => { onChange={(color): void => {
setBorderColor(color); setBorderColor(color);
setColorPickerOpen(false); setColorPickerOpen(false);

View File

@@ -9,6 +9,7 @@ import { theme } from "../../theme";
// Types // Types
type ColorPickerProps = { type ColorPickerProps = {
color: string; color: string;
defaultColor: string;
title: string; title: string;
onChange: (color: string) => void; onChange: (color: string) => void;
onClose: () => void; onClose: () => void;
@@ -23,6 +24,7 @@ const colorPickerWidth = 240;
// Main Component // Main Component
const ColorPicker = ({ const ColorPicker = ({
color, color,
defaultColor,
title, title,
onChange, onChange,
onClose, onClose,
@@ -177,8 +179,8 @@ const ColorPicker = ({
open={isMenuOpen} open={isMenuOpen}
onClose={handleClose} onClose={handleClose}
> >
<MenuItemWrapper onClick={() => handleColorSelect(color)}> <MenuItemWrapper onClick={() => handleColorSelect(defaultColor)}>
<MenuItemSquare style={{ backgroundColor: color }} /> <MenuItemSquare style={{ backgroundColor: defaultColor }} />
<MenuItemText>{title}</MenuItemText> <MenuItemText>{title}</MenuItemText>
</MenuItemWrapper> </MenuItemWrapper>
<HorizontalDivider /> <HorizontalDivider />

View File

@@ -138,6 +138,7 @@ function SheetTab(props: SheetTabProps) {
/> />
<ColorPicker <ColorPicker
color={color} color={color}
defaultColor="#FFFFFF"
title={t("color_picker.no_fill")} title={t("color_picker.no_fill")}
onChange={(color): void => { onChange={(color): void => {
props.onColorChanged(color); props.onColorChanged(color);

View File

@@ -443,6 +443,7 @@ function Toolbar(properties: ToolbarProperties) {
<ColorPicker <ColorPicker
color={properties.fontColor} color={properties.fontColor}
defaultColor="#000000"
title={t("color_picker.default")} title={t("color_picker.default")}
onChange={(color): void => { onChange={(color): void => {
properties.onTextColorPicked(color); properties.onTextColorPicked(color);
@@ -456,6 +457,7 @@ function Toolbar(properties: ToolbarProperties) {
/> />
<ColorPicker <ColorPicker
color={properties.fillColor} color={properties.fillColor}
defaultColor="#FFFFFF"
title={t("color_picker.default")} title={t("color_picker.default")}
onChange={(color): void => { onChange={(color): void => {
if (color !== null) { if (color !== null) {