@@ -8,7 +8,7 @@ import {
|
|||||||
Typography,
|
Typography,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from "@linagora/twake-mui";
|
} from "@linagora/twake-mui";
|
||||||
import { useState } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { HexColorPicker } from "react-colorful";
|
import { HexColorPicker } from "react-colorful";
|
||||||
import { useI18n } from "twake-i18n";
|
import { useI18n } from "twake-i18n";
|
||||||
import { defaultColors, getAccessiblePair } from "./utils/calendarColorsUtils";
|
import { defaultColors, getAccessiblePair } from "./utils/calendarColorsUtils";
|
||||||
@@ -27,6 +27,15 @@ export function ColorPicker({
|
|||||||
? selectedColor
|
? selectedColor
|
||||||
: undefined
|
: undefined
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!colors.find((c) => c.light === selectedColor?.light)) {
|
||||||
|
setCustomColor(selectedColor);
|
||||||
|
} else {
|
||||||
|
setCustomColor(undefined);
|
||||||
|
}
|
||||||
|
}, [selectedColor, colors]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box display="flex" alignItems="center" gap={1}>
|
<Box display="flex" alignItems="center" gap={1}>
|
||||||
{colors.map((c) => (
|
{colors.map((c) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user