Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
No files matched your search
+73
@@ -0,0 +1,73 @@
|
||||
import type { CSSProperties, ReactNode } from "react";
|
||||
import { Header } from "./Header.js";
|
||||
import { Footer } from "./Footer.js";
|
||||
import type { MailBrand } from "./theme.js";
|
||||
|
||||
/**
|
||||
* BaseLayout — root layout for transactional emails. Renders a 560px
|
||||
* centred card with brand-themed header and footer, plus a hidden
|
||||
* preview-text harvested by Gmail/Apple Mail as the inbox snippet.
|
||||
*/
|
||||
export interface BaseLayoutProps {
|
||||
readonly brand: MailBrand;
|
||||
readonly title: string;
|
||||
readonly previewText?: string;
|
||||
readonly unsubscribeUrl?: string;
|
||||
readonly children: ReactNode;
|
||||
}
|
||||
|
||||
const bodyStyle = (brand: MailBrand): CSSProperties => ({
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
backgroundColor: brand.backgroundColor,
|
||||
color: brand.textColor,
|
||||
fontFamily: brand.fontFamily,
|
||||
fontSize: "16px",
|
||||
lineHeight: "1.5",
|
||||
});
|
||||
|
||||
const containerStyle: CSSProperties = {
|
||||
width: "100%",
|
||||
maxWidth: "560px",
|
||||
margin: "0 auto",
|
||||
padding: "24px 16px",
|
||||
};
|
||||
|
||||
const cardStyle = (brand: MailBrand): CSSProperties => ({
|
||||
backgroundColor: brand.surfaceColor,
|
||||
border: `1px solid ${brand.borderColor}`,
|
||||
borderRadius: "20px",
|
||||
padding: "32px",
|
||||
});
|
||||
|
||||
const previewStyle: CSSProperties = {
|
||||
display: "none",
|
||||
fontSize: "1px",
|
||||
lineHeight: "1px",
|
||||
maxHeight: 0,
|
||||
maxWidth: 0,
|
||||
opacity: 0,
|
||||
overflow: "hidden",
|
||||
} as CSSProperties;
|
||||
|
||||
export function BaseLayout({ brand, title, previewText, unsubscribeUrl, children }: BaseLayoutProps) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charSet="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>{title}</title>
|
||||
</head>
|
||||
<body style={bodyStyle(brand)}>
|
||||
{previewText ? <div style={previewStyle}>{previewText}</div> : null}
|
||||
<div style={containerStyle}>
|
||||
<div style={cardStyle(brand)}>
|
||||
<Header brand={brand} />
|
||||
{children}
|
||||
<Footer brand={brand} unsubscribeUrl={unsubscribeUrl} />
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user