infoalloggi-monorepo/apps/infoalloggi/emails/gereric-email.tsx

61 lines
1.3 KiB
TypeScript

import { Button, Heading, Row, Section, Text } from "@react-email/components";
import type { ReactNode } from "react";
import Base from "./base";
export type Generic_NewMail = {
mailType: "generic";
props: GenericProps;
};
type Corpo = {
testo?: undefined;
corpo: ReactNode;
};
type Testo = {
testo: string;
corpo?: undefined;
};
type GenericProps = {
title: string;
noreply?: boolean;
link?: {
href: string;
label?: string;
};
} & (Corpo | Testo);
const Generic = ({
title,
noreply = false,
testo,
corpo,
link = undefined,
}: GenericProps) => {
return (
<Base noreply={noreply} preview={title}>
<>
<Heading className="text-center text-3xl leading-8">{title}</Heading>
<Section className="px-5 text-left text-base md:px-12">
{corpo ? (
corpo
) : (
<Row>
<Text>{testo}</Text>
</Row>
)}
{link && (
<Section className="mb-5">
<Button
className="mx-auto box-border inline-flex h-10 items-center justify-center whitespace-nowrap rounded-md bg-neutral-100 px-4 py-2 text-center align-middle font-semibold text-neutral-900"
href={`${link.href}`}
>
{link.label}
</Button>
</Section>
)}
</Section>
</>
</Base>
);
};
export default Generic;