Add "light-brand" and "dark-brand" colors (add a second color picker) (#2028)

* init dark brand color addition

* added dark mode css vars

* added contrast brand colors

* minor fixes

* added dark branding to loader, button

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Syed Ali Shahbazandkodiakhq[bot] authored and GitHub committed 2022-03-05 15:37:46 +00:00
1 parent ce0c8347fb
commit 8c4eed2bbc
30 files changed
+96 -35

No files matched your search

+2
View File
@@ -79,6 +79,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
availability: true,
hideBranding: true,
brandColor: true,
darkBrandColor: true,
theme: true,
plan: true,
eventTypes: {
@@ -192,6 +193,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
theme: user.theme,
weekStart: user.weekStart,
brandColor: user.brandColor,
darkBrandColor: user.darkBrandColor,
},
date: dateParam,
eventType: eventTypeObject,
+2
View File
@@ -37,6 +37,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
avatar: true,
theme: true,
brandColor: true,
darkBrandColor: true,
},
});
@@ -140,6 +141,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
image: user.avatar,
theme: user.theme,
brandColor: user.brandColor,
darkBrandColor: user.darkBrandColor,
},
eventType: eventTypeObject,
booking,
+4 -4
View File
@@ -64,8 +64,8 @@ const AvailabilityView = ({ user }: { user: User }) => {
/>
<small className="block text-neutral-400">{t("hover_over_bold_times_tip")}</small>
<div className="mt-4 space-y-4">
<div className="bg-brand overflow-hidden rounded-sm">
<div className="text-brandcontrast px-4 py-2 sm:px-6">
<div className="bg-brand dark:bg-darkmodebrand overflow-hidden rounded-sm">
<div className="text-brandcontrast dark:text-darkmodebrandcontrast px-4 py-2 sm:px-6">
{t("your_day_starts_at")} {convertMinsToHrsMins(user.startTime)}
</div>
</div>
@@ -94,8 +94,8 @@ const AvailabilityView = ({ user }: { user: User }) => {
</div>
)}
<div className="bg-brand overflow-hidden rounded-sm">
<div className="text-brandcontrast px-4 py-2 sm:px-6">
<div className="bg-brand dark:bg-darkmodebrand overflow-hidden rounded-sm">
<div className="text-brandcontrast dark:text-darkmodebrandcontrast px-4 py-2 sm:px-6">
{t("your_day_ends_at")} {convertMinsToHrsMins(user.endTime)}
</div>
</div>
+3 -1
View File
@@ -35,7 +35,7 @@ export default function Type(props: inferSSRProps<typeof getServerSideProps>) {
title={`${t("cancel")} ${props.booking && props.booking.title} | ${props.profile?.name}`}
description={`${t("cancel")} ${props.booking && props.booking.title} | ${props.profile?.name}`}
/>
<CustomBranding val={props.profile?.brandColor} />
<CustomBranding lightVal={props.profile?.brandColor} darkVal={props.profile?.darkBrandColor} />
<main className="mx-auto my-24 max-w-3xl">
<div className="fixed inset-0 z-50 overflow-y-auto">
<div className="flex min-h-screen items-end justify-center px-4 pt-4 pb-20 text-center sm:block sm:p-0">
@@ -179,6 +179,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
username: true,
name: true,
brandColor: true,
darkBrandColor: true,
},
},
eventType: {
@@ -210,6 +211,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
name: booking.eventType?.team?.name || booking.user?.name || null,
slug: booking.eventType?.team?.slug || booking.user?.username || null,
brandColor: booking.user?.brandColor || null,
darkBrandColor: booking.user?.darkBrandColor || null,
};
return {
+17 -5
View File
@@ -176,6 +176,7 @@ function SettingsView(props: ComponentProps<typeof Settings> & { localeProp: str
const [hasErrors, setHasErrors] = useState(false);
const [errorMessage, setErrorMessage] = useState("");
const [brandColor, setBrandColor] = useState(props.user.brandColor);
const [darkBrandColor, setDarkBrandColor] = useState(props.user.darkBrandColor);
useEffect(() => {
if (!props.user.theme) return;
@@ -194,6 +195,7 @@ function SettingsView(props: ComponentProps<typeof Settings> & { localeProp: str
const enteredDescription = descriptionRef.current.value;
const enteredAvatar = avatarRef.current.value;
const enteredBrandColor = brandColor;
const enteredDarkBrandColor = darkBrandColor;
const enteredTimeZone = typeof selectedTimeZone === "string" ? selectedTimeZone : selectedTimeZone.value;
const enteredWeekStartDay = selectedWeekStartDay.value;
const enteredHideBranding = hideBrandingRef.current.checked;
@@ -213,6 +215,7 @@ function SettingsView(props: ComponentProps<typeof Settings> & { localeProp: str
hideBranding: enteredHideBranding,
theme: asStringOrNull(selectedTheme?.value),
brandColor: enteredBrandColor,
darkBrandColor: enteredDarkBrandColor,
locale: enteredLanguage,
timeFormat: enteredTimeFormat,
});
@@ -424,11 +427,19 @@ function SettingsView(props: ComponentProps<typeof Settings> & { localeProp: str
</div>
</div>
</div>
<div>
<label htmlFor="brandColor" className="block text-sm font-medium text-gray-700">
{t("brand_color")}
</label>
<ColorPicker defaultValue={props.user.brandColor} onChange={setBrandColor} />
<div className="block rtl:space-x-reverse sm:flex sm:space-x-2">
<div className="mb-6 w-full sm:w-1/2">
<label htmlFor="brandColor" className="block text-sm font-medium text-gray-700">
{t("light_brand_color")}
</label>
<ColorPicker defaultValue={props.user.brandColor} onChange={setBrandColor} />
</div>
<div className="mb-6 w-full sm:w-1/2">
<label htmlFor="darkBrandColor" className="block text-sm font-medium text-gray-700">
{t("dark_brand_color")}
</label>
<ColorPicker defaultValue={props.user.darkBrandColor} onChange={setDarkBrandColor} />
</div>
<hr className="mt-6" />
</div>
<div>
@@ -524,6 +535,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
theme: true,
plan: true,
brandColor: true,
darkBrandColor: true,
metadata: true,
timeFormat: true,
},
+4 -1
View File
@@ -96,7 +96,7 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)
title={needsConfirmation ? t("booking_submitted") : t("booking_confirmed")}
description={needsConfirmation ? t("booking_submitted") : t("booking_confirmed")}
/>
<CustomBranding val={props.profile.brandColor} />
<CustomBranding lightVal={props.profile.brandColor} darkVal={props.profile.darkBrandColor} />
<main className="mx-auto max-w-3xl py-24">
<div className="fixed inset-0 z-50 overflow-y-auto">
<div className="flex min-h-screen items-end justify-center px-4 pt-4 pb-20 text-center sm:block sm:p-0">
@@ -320,6 +320,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
plan: true,
theme: true,
brandColor: true,
darkBrandColor: true,
},
},
team: {
@@ -348,6 +349,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
plan: true,
theme: true,
brandColor: true,
darkBrandColor: true,
},
});
if (user) {
@@ -365,6 +367,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
name: eventType.team?.name || eventType.users[0]?.name || null,
theme: (!eventType.team?.name && eventType.users[0]?.theme) || null,
brandColor: eventType.team ? null : eventType.users[0].brandColor,
darkBrandColor: eventType.team ? null : eventType.users[0].darkBrandColor,
};
return {
+2
View File
@@ -48,6 +48,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
hideBranding: true,
plan: true,
brandColor: true,
darkBrandColor: true,
},
},
title: true,
@@ -105,6 +106,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
theme: null,
weekStart: "Sunday",
brandColor: "" /* TODO: Add a way to set a brand color for Teams */,
darkBrandColor: "" /* TODO: Add a way to set a brand color for Teams */,
},
date: dateParam,
eventType: eventTypeObject,
+1
View File
@@ -102,6 +102,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
image: eventTypeObject.team?.logo || null,
theme: null /* Teams don't have a theme, and `BookingPage` uses it */,
brandColor: null /* Teams don't have a brandColor, and `BookingPage` uses it */,
darkBrandColor: null /* Teams don't have a darkBrandColor, and `BookingPage` uses it */,
},
eventType: eventTypeObject,
booking,