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

62 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-08-04 17:45:44 +02:00
import { Button, Heading, Row, Section, Text } from "@react-email/components";
import type { ReactNode } from "react";
2025-08-04 17:45:44 +02:00
import Base from "./base";
export type Generic_NewMail = {
2025-08-29 16:18:32 +02:00
mailType: "generic";
props: GenericProps;
2025-08-04 17:45:44 +02:00
};
type Corpo = {
testo?: undefined;
corpo: ReactNode;
};
type Testo = {
testo: string;
corpo?: undefined;
};
2025-08-04 17:45:44 +02:00
type GenericProps = {
2025-08-29 16:18:32 +02:00
title: string;
noreply?: boolean;
2025-08-29 16:18:32 +02:00
link?: {
href: string;
label?: string;
};
} & (Corpo | Testo);
2025-08-04 17:45:44 +02:00
const Generic = ({
2025-08-29 16:18:32 +02:00
title,
noreply = false,
testo,
corpo,
2025-08-29 16:18:32 +02:00
link = undefined,
2025-08-04 17:45:44 +02:00
}: GenericProps) => {
2025-08-29 16:18:32 +02:00
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>
)}
2025-08-29 16:18:32 +02:00
{link && (
<Section className="mb-5">
<Button
2025-10-10 16:18:43 +02:00
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"
2025-08-29 16:18:32 +02:00
href={`${link.href}`}
>
{link.label}
</Button>
</Section>
)}
</Section>
</>
</Base>
);
2025-08-04 17:45:44 +02:00
};
export default Generic;