Skip to content

Commit

Permalink
add sketch of API for exporting zod schema
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmfern committed Jan 16, 2025
1 parent 2dc7739 commit 9d134b9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
21 changes: 11 additions & 10 deletions apps/demo/emails/magic-links/aws-verify-email.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import {
Section,
Text,
} from "@react-email/components";
import { setupForPreview } from "react-email";
import { z } from "zod";

interface AWSVerifyEmailProps {
verificationCode: string;
}
const AWSVerifyEmailProps = z.object({
verificationCode: z.string()
});

type AWSVerifyEmailProps = z.infer<typeof AWSVerifyEmailProps>;

const baseUrl = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
Expand Down Expand Up @@ -84,12 +86,11 @@ export default function AWSVerifyEmail({
);
}

setupForPreview(AWSVerifyEmail, {
verificationCode: {
type: "text",
defaultValue: "596853",
},
});
AWSVerifyEmail.PreviewProps = {
verificationCode: '596583'
} satisfies AWSVerifyEmailProps;

AWSVerifyEmail.PreviewSchema = AWSVerifyEmailProps;

const main = {
backgroundColor: "#fff",
Expand Down
5 changes: 3 additions & 2 deletions apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
"@react-email/components": "workspace:*",
"react": "^19",
"react-dom": "^19",
"react-email": "workspace:*"
"react-email": "workspace:*",
"zod": "3.24.1"
},
"devDependencies": {
"next": "15.1.2",
"@types/react": "^19",
"@types/react-dom": "^19",
"next": "15.1.2",
"tsx": "4.9.0"
}
}
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9d134b9

Please sign in to comment.