🧱 Render email based on razor components

This commit is contained in:
2025-05-17 17:00:46 +08:00
parent cbef69ba5e
commit d3b56b741e
11 changed files with 323 additions and 64 deletions

View File

@ -0,0 +1,18 @@
@inherits LayoutComponentBase
<div class="min-h-screen bg-gray-100 py-8 font-sans">
<div class="max-w-2xl mx-auto px-8">
<div class="bg-white rounded-lg shadow-md p-6">
@ChildContent
</div>
<div class="text-center mt-6 text-sm text-gray-500">
<p class="m-0">&copy; @DateTime.Now.Year DysonNetwork. All rights reserved.</p>
</div>
</div>
</div>
@code {
[Parameter]
public RenderFragment? ChildContent { get; set; }
}

View File

@ -0,0 +1,47 @@
<EmailLayout>
<div style="text-align: center; margin-bottom: 2rem;">
<h1 style="font-size: 1.875rem; font-weight: 700; color: #111827; margin: 0;">Welcome to DysonNetwork!</h1>
</div>
<div style="display: flex; flex-direction: column; gap: 1.5rem;">
<p style="color: #374151; margin: 0;">
Dear @Name,
</p>
<p style="color: #374151; margin: 0;">
Thank you for creating an account with DysonNetwork. We're excited to have you join our community!
</p>
<p style="color: #374151; margin: 0;">
To access all features and ensure the security of your account, please confirm your registration by clicking
the button below:
</p>
<div style="text-align: center; margin: 2rem 0;">
<a href="@VerificationLink"
style="display: inline-block; padding: 0.75rem 1.5rem; background-color: #2563eb; color: #ffffff; text-decoration: none; font-weight: 600; border-radius: 0.5rem;">
Confirm Registration
</a>
</div>
<p style="color: #374151; margin: 0;">
If the button doesn't work, you can also copy and paste this link into your browser:
<br>
<span style="color: #2563eb; word-break: break-all;">@VerificationLink</span>
</p>
<p style="color: #374151; margin: 0;">
If you didn't create this account, please ignore this email.
</p>
<p style="color: #374151; margin: 2rem 0 0 0;">
Best regards,<br>
The DysonNetwork Team
</p>
</div>
</EmailLayout>
@code {
[Parameter] public required string Name { get; set; }
[Parameter] public required string VerificationLink { get; set; }
}

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewData["Title"]</title>
</head>
<body style="margin: 0; padding: 0; background-color: #f3f4f6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;">
<div style="max-width: 42rem; margin: 0 auto; padding: 2rem;">
<div style="background-color: #ffffff; border-radius: 0.5rem; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); padding: 1.5rem;">
@RenderBody()
</div>
<div style="text-align: center; margin-top: 1.5rem; font-size: 0.875rem; color: #6b7280;">
<p style="margin: 0;">&copy; @DateTime.Now.Year DysonNetwork. All rights reserved.</p>
</div>
</div>
</body>
</html>