mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-15 18:18:48 -06:00
Co-authored-by: Piyush Gupta <piyushguptaa2z123@gmail.com> Co-authored-by: Piyush Gupta <56182734+gupta-piyush19@users.noreply.github.com> Co-authored-by: Victor Hugo dos Santos <115753265+victorvhs017@users.noreply.github.com> Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com> Co-authored-by: Matti Nannt <matti@formbricks.com> Co-authored-by: Matti Nannt <mail@matthiasnannt.com> Co-authored-by: Johannes <johannes@formbricks.com> Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com>
86 lines
2.9 KiB
TypeScript
86 lines
2.9 KiB
TypeScript
import { Body, Container, Html, Img, Link, Section, Tailwind, Text } from "@react-email/components";
|
|
import { TFunction } from "i18next";
|
|
import React from "react";
|
|
import { FB_LOGO_URL, IMPRINT_ADDRESS, IMPRINT_URL, PRIVACY_URL } from "@/lib/constants";
|
|
|
|
const fbLogoUrl = FB_LOGO_URL;
|
|
const logoLink = "https://formbricks.com?utm_source=email_header&utm_medium=email";
|
|
|
|
interface EmailTemplateProps {
|
|
readonly children: React.ReactNode;
|
|
readonly logoUrl?: string;
|
|
readonly t: TFunction;
|
|
}
|
|
|
|
export async function EmailTemplate({
|
|
children,
|
|
logoUrl,
|
|
t,
|
|
}: EmailTemplateProps): Promise<React.JSX.Element> {
|
|
const isDefaultLogo = !logoUrl || logoUrl === fbLogoUrl;
|
|
|
|
return (
|
|
<Html>
|
|
<Tailwind>
|
|
<Body
|
|
className="m-0 h-full w-full justify-center bg-slate-50 p-6 text-center text-sm text-slate-800"
|
|
style={{
|
|
fontFamily: "'Jost', 'Helvetica Neue', 'Segoe UI', 'Helvetica', 'sans-serif'",
|
|
}}>
|
|
<Section>
|
|
{isDefaultLogo ? (
|
|
<Link href={logoLink} target="_blank">
|
|
<Img data-testid="default-logo-image" alt="Logo" className="mx-auto w-60" src={fbLogoUrl} />
|
|
</Link>
|
|
) : (
|
|
<Img
|
|
data-testid="logo-image"
|
|
alt="Logo"
|
|
className="mx-auto max-h-[100px] w-80 object-contain"
|
|
src={logoUrl}
|
|
/>
|
|
)}
|
|
</Section>
|
|
<Container className="mx-auto my-8 max-w-xl rounded-md bg-white p-4 text-left">
|
|
{children}
|
|
</Container>
|
|
|
|
<Section className="mt-4 text-center text-sm">
|
|
<Link
|
|
className="m-0 text-sm font-normal text-slate-500"
|
|
href="https://formbricks.com/?utm_source=email_header&utm_medium=email"
|
|
target="_blank"
|
|
rel="noopener noreferrer">
|
|
{t("emails.email_template_text_1")}
|
|
</Link>
|
|
{IMPRINT_ADDRESS && (
|
|
<Text className="m-0 text-sm font-normal text-slate-500 opacity-50">{IMPRINT_ADDRESS}</Text>
|
|
)}
|
|
<Text className="m-0 text-sm font-normal text-slate-500 opacity-50">
|
|
{IMPRINT_URL && (
|
|
<Link
|
|
href={IMPRINT_URL}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="text-sm text-slate-500">
|
|
{t("emails.imprint")}
|
|
</Link>
|
|
)}
|
|
{IMPRINT_URL && PRIVACY_URL && " • "}
|
|
{PRIVACY_URL && (
|
|
<Link
|
|
href={PRIVACY_URL}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="text-sm text-slate-500">
|
|
{t("emails.privacy_policy")}
|
|
</Link>
|
|
)}
|
|
</Text>
|
|
</Section>
|
|
</Body>
|
|
</Tailwind>
|
|
</Html>
|
|
);
|
|
}
|