Skip to content

Commit

Permalink
fix: color restrictions issue (#16360)
Browse files Browse the repository at this point in the history
* fix: color restrictions issue

* Update EventAdvancedTab.tsx
  • Loading branch information
anikdhabal authored Aug 26, 2024
1 parent c8e20b0 commit 4caa095
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions apps/web/components/eventtype/EventAdvancedTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions apps/web/pages/settings/my-account/appearance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
Expand All @@ -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 ? (
Expand Down
4 changes: 2 additions & 2 deletions packages/features/ee/components/BrandColorsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
Expand All @@ -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 ? (
Expand Down

0 comments on commit 4caa095

Please sign in to comment.