feat: brand color overwrite (#1035)

This commit is contained in:
Piyush Gupta
2023-10-11 14:16:34 +05:30
committed by GitHub
parent e7d95f9d75
commit 311df18315
3 changed files with 32 additions and 17 deletions

View File

@@ -36,7 +36,8 @@ export default async function handle(req: NextApiRequest, res: NextApiResponse)
},
{
name: "dyrector.io",
description: "dyrector.io is an open-source continuous delivery & deployment platform with version management.",
description:
"dyrector.io is an open-source continuous delivery & deployment platform with version management.",
href: "https://dyrector.io",
},
{

View File

@@ -32,6 +32,7 @@ export default function ShareEmbedSurvey({
const isSingleUseLinkSurvey = survey.singleUse?.enabled;
const { email } = profile;
const { brandColor } = product;
const surveyBrandColor = survey.productOverwrites?.brandColor || brandColor;
const tabs = [
{ id: "link", label: `${isSingleUseLinkSurvey ? "Single Use Links" : "Share the Link"}`, icon: LinkIcon },
@@ -45,9 +46,9 @@ export default function ShareEmbedSurvey({
link: isSingleUseLinkSurvey ? (
<LinkSingleUseSurveyModal survey={survey} surveyBaseUrl={surveyBaseUrl} />
) : (
<LinkTab surveyUrl={surveyUrl} survey={survey} brandColor={brandColor} />
<LinkTab surveyUrl={surveyUrl} survey={survey} brandColor={surveyBrandColor} />
),
email: <EmailTab survey={survey} surveyUrl={surveyUrl} email={email} brandColor={brandColor} />,
email: <EmailTab survey={survey} surveyUrl={surveyUrl} email={email} brandColor={surveyBrandColor} />,
webpage: <WebpageTab surveyUrl={surveyUrl} />,
};

View File

@@ -21,6 +21,7 @@ import {
} from "@react-email/components";
import { useMemo, useState } from "react";
import toast from "react-hot-toast";
import { isLight } from "@/lib/utils";
interface EmailTabProps {
survey: TSurvey;
@@ -175,7 +176,10 @@ const getEmailTemplate = (survey: TSurvey, surveyUrl: string, brandColor: string
)}
<EmailButton
href={`${urlWithPrefilling}${firstQuestion.id}=accepted`}
className="bg-brand-color ml-2 inline-flex cursor-pointer appearance-none rounded-md px-6 py-3 text-sm font-medium text-white">
className={cn(
"bg-brand-color ml-2 inline-flex cursor-pointer appearance-none rounded-md px-6 py-3 text-sm font-medium",
isLight(brandColor) ? "text-black" : "text-white"
)}>
Accept
</EmailButton>
</Container>
@@ -215,12 +219,15 @@ const getEmailTemplate = (survey: TSurvey, surveyUrl: string, brandColor: string
</Section>
</Container>
{/* {!firstQuestion.required && (
<EmailButton
href={`${urlWithPrefilling}${firstQuestion.id}=dismissed`}
className="mt-4 cursor-pointer appearance-none rounded-md bg-brand-color px-6 py-3 text-sm font-medium text-white">
{firstQuestion.buttonLabel || "Skip"}
</EmailButton>
)} */}
<EmailButton
href={`${urlWithPrefilling}${firstQuestion.id}=dismissed`}
className={cn(
"bg-brand-color mt-4 cursor-pointer appearance-none rounded-md px-6 py-3 text-sm font-medium",
isLight(brandColor) ? "text-black" : "text-white"
)}>
{firstQuestion.buttonLabel || "Skip"}
</EmailButton>
)} */}
<EmailFooter />
</Section>
@@ -246,7 +253,10 @@ const getEmailTemplate = (survey: TSurvey, surveyUrl: string, brandColor: string
)}
<EmailButton
href={`${urlWithPrefilling}${firstQuestion.id}=clicked`}
className="bg-brand-color inline-flex cursor-pointer appearance-none rounded-md px-6 py-3 text-sm font-medium text-white">
className={cn(
"bg-brand-color inline-flex cursor-pointer appearance-none rounded-md px-6 py-3 text-sm font-medium",
isLight(brandColor) ? "text-black" : "text-white"
)}>
{firstQuestion.buttonLabel}
</EmailButton>
</Container>
@@ -296,12 +306,15 @@ const getEmailTemplate = (survey: TSurvey, surveyUrl: string, brandColor: string
</Section>
</Container>
{/* {!firstQuestion.required && (
<EmailButton
href={`${urlWithPrefilling}${firstQuestion.id}=dismissed`}
className="mt-4 cursor-pointer appearance-none rounded-md bg-brand-color px-6 py-3 text-sm font-medium text-white">
{firstQuestion.buttonLabel || "Skip"}
</EmailButton>
)} */}
<EmailButton
href={`${urlWithPrefilling}${firstQuestion.id}=dismissed`}
className={cn(
"bg-brand-color mt-4 cursor-pointer appearance-none rounded-md px-6 py-3 text-sm font-medium",
isLight(brandColor) ? "text-black" : "text-white"
)}>
{firstQuestion.buttonLabel || "Skip"}
</EmailButton>
)} */}
<EmailFooter />
</Section>
</EmailTemplateWrapper>