fix: color restrictions issue (#16360)

* fix: color restrictions issue

* Update EventAdvancedTab.tsx
This commit is contained in:
Anik Dhabal Babu
2024-08-27 07:59:09 +09:00
committed by GitHub
parent c8e20b0c57
commit 4caa095d52
3 changed files with 16 additions and 16 deletions
@@ -582,14 +582,14 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
<ColorPicker
defaultValue={eventTypeColorState.lightEventTypeColor}
onChange={(value) => {
const newVal = {
...eventTypeColorState,
lightEventTypeColor: value,
};
formMethods.setValue("eventTypeColor", newVal, { shouldDirty: true });
setEventTypeColorState(newVal);
if (checkWCAGContrastColor("#ffffff", value)) {
const newVal = {
...eventTypeColorState,
lightEventTypeColor: value,
};
setLightModeError(false);
formMethods.setValue("eventTypeColor", newVal, { shouldDirty: true });
setEventTypeColorState(newVal);
} else {
setLightModeError(true);
}
@@ -607,14 +607,14 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
<ColorPicker
defaultValue={eventTypeColorState.darkEventTypeColor}
onChange={(value) => {
const newVal = {
...eventTypeColorState,
darkEventTypeColor: value,
};
formMethods.setValue("eventTypeColor", newVal, { shouldDirty: true });
setEventTypeColorState(newVal);
if (checkWCAGContrastColor("#101010", value)) {
const newVal = {
...eventTypeColorState,
darkEventTypeColor: value,
};
setDarkModeError(false);
formMethods.setValue("eventTypeColor", newVal, { shouldDirty: true });
setEventTypeColorState(newVal);
} else {
setDarkModeError(true);
}
@@ -350,10 +350,10 @@ const AppearanceView = ({
onChange={(value) => {
if (checkWCAGContrastColor("#ffffff", value)) {
setLightModeError(false);
brandColorsFormMethods.setValue("brandColor", value, { shouldDirty: true });
} else {
setLightModeError(true);
}
brandColorsFormMethods.setValue("brandColor", value, { shouldDirty: true });
}}
/>
{lightModeError ? (
@@ -378,10 +378,10 @@ const AppearanceView = ({
onChange={(value) => {
if (checkWCAGContrastColor("#101010", value)) {
setDarkModeError(false);
brandColorsFormMethods.setValue("darkBrandColor", value, { shouldDirty: true });
} else {
setDarkModeError(true);
}
brandColorsFormMethods.setValue("darkBrandColor", value, { shouldDirty: true });
}}
/>
{darkModeError ? (
@@ -68,10 +68,10 @@ const BrandColorsForm = ({
onChange={(value) => {
if (checkWCAGContrastColor("#ffffff", value)) {
setLightModeError(false);
brandColorsFormMethods.setValue("brandColor", value, { shouldDirty: true });
} else {
setLightModeError(true);
}
brandColorsFormMethods.setValue("brandColor", value, { shouldDirty: true });
}}
/>
{lightModeError ? (
@@ -96,10 +96,10 @@ const BrandColorsForm = ({
onChange={(value) => {
if (checkWCAGContrastColor("#101010", value)) {
setDarkModeError(false);
brandColorsFormMethods.setValue("darkBrandColor", value, { shouldDirty: true });
} else {
setDarkModeError(true);
}
brandColorsFormMethods.setValue("darkBrandColor", value, { shouldDirty: true });
}}
/>
{darkModeError ? (