Amba-Emails/emails/components/EmailLayout.tsx
2025-12-14 22:50:58 +03:00

105 lines
2.2 KiB
TypeScript

import React from 'react';
import {
Body,
Container,
Head,
Heading,
Html,
Img,
Link,
Preview,
Section,
Text,
} from '@react-email/components';
import { theme } from '../theme';
import { logoDataUri } from '../utils/logoDataUri';
interface EmailLayoutProps {
preview?: string;
children: React.ReactNode;
logoUrl?: string;
}
export const EmailLayout = ({
preview,
children,
logoUrl = logoDataUri,
}: EmailLayoutProps) => {
return (
<Html>
<Head>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap" rel="stylesheet" />
</Head>
<Preview>{preview}</Preview>
<Body style={main}>
<Container style={container}>
<Section style={header}>
<Img
src={logoUrl}
width="86"
height="80"
alt="Amba Logo"
style={logo}
/>
</Section>
{children}
<Section style={footer}>
<Text style={footerText}>
© {new Date().getFullYear()} AmbaPay LLC. All rights reserved.
</Text>
<Text style={footerText}>
<Link href="#" style={footerLink}>
Privacy Policy
</Link>{' '}
|{' '}
<Link href="#" style={footerLink}>
Terms of Service
</Link>
</Text>
</Section>
</Container>
</Body>
</Html>
);
};
const main = {
backgroundColor: theme.colors.background,
fontFamily: theme.fonts.sans,
};
const container = {
margin: '0 auto',
padding: '20px 0 48px',
maxWidth: '600px',
};
const header = {
padding: '32px 0',
textAlign: 'center' as const,
borderBottom: `2px solid ${theme.colors.accent}`,
marginBottom: '32px',
};
const logo = {
margin: '0 auto',
};
const footer = {
marginTop: '48px',
paddingTop: '24px',
borderTop: `1px solid ${theme.colors.border}`,
textAlign: 'center' as const,
};
const footerText = {
fontSize: '12px',
color: theme.colors.text,
margin: '4px 0',
};
const footerLink = {
color: theme.colors.primary,
textDecoration: 'underline',
};