import { Button, Heading, Row, Section, Text } from "@react-email/components"; import type { ReactNode } from "react"; import z from "zod"; import Base from "./base"; export const GenericMailTag = "generic"; const props_base = z.object({ title: z.string(), noreply: z.boolean().optional(), link: z .object({ href: z.string(), label: z.string().optional(), }) .optional(), }); const props_content = z.union([ z.object({ corpo: z.custom(), testo: z.undefined().optional(), }), z.object({ testo: z.string(), corpo: z.undefined().optional(), }), ]); export const GenericPropsSchema = props_base.and(props_content); const Generic = ({ title, noreply = false, testo, corpo, link = undefined, }: z.infer) => { return ( <> {title}
{corpo ? ( corpo ) : ( {testo} )} {link && (
)}
); }; export default Generic;