From de61b032b78eede4ee3e97463de5d8a11ba702a2 Mon Sep 17 00:00:00 2001 From: Peer Richelsen Date: Wed, 19 Apr 2023 16:39:23 +0200 Subject: [PATCH] RFC: added brandcolor for switch (#8213) --- .../pages/settings/my-account/appearance.tsx | 18 +++++++++++++++++- packages/config/tailwind-preset.js | 7 ++++--- packages/lib/getBrandColours.tsx | 2 ++ packages/ui/components/form/switch/Switch.tsx | 6 +++--- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/apps/web/pages/settings/my-account/appearance.tsx b/apps/web/pages/settings/my-account/appearance.tsx index d65ef9c31b..8403619d68 100644 --- a/apps/web/pages/settings/my-account/appearance.tsx +++ b/apps/web/pages/settings/my-account/appearance.tsx @@ -52,6 +52,7 @@ const AppearanceView = () => { const utils = trpc.useContext(); const { data: user, isLoading } = trpc.viewer.me.useQuery(); const [darkModeError, setDarkModeError] = useState(false); + const [lightModeError, setLightModeError] = useState(false); const { isLoading: isTeamPlanStatusLoading, hasPaidPlan } = useHasPaidPlan(); @@ -145,7 +146,14 @@ const AppearanceView = () => {

{t("light_brand_color")}

formMethods.setValue("brandColor", value, { shouldDirty: true })} + onChange={(value) => { + if (!checkWCAGContrastColor("#ffffff", value)) { + setLightModeError(true); + } else { + setLightModeError(false); + } + formMethods.setValue("brandColor", value, { shouldDirty: true }); + }} /> )} @@ -180,6 +188,14 @@ const AppearanceView = () => { /> ) : null} + {lightModeError ? ( +
+ +
+ ) : null} {/* TODO future PR to preview brandColors */} {/*