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
+67
@@ -0,0 +1,67 @@
|
||||
import type { CSSProperties, ReactNode } from "react";
|
||||
import { theme } from "../theme.js";
|
||||
|
||||
export interface LayoutProps {
|
||||
readonly previewText?: string;
|
||||
readonly title?: string;
|
||||
readonly children: ReactNode;
|
||||
readonly footer?: ReactNode;
|
||||
}
|
||||
|
||||
const bodyStyle: CSSProperties = {
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
backgroundColor: theme.colors.background,
|
||||
color: theme.colors.text,
|
||||
fontFamily: theme.fontFamily,
|
||||
fontSize: "16px",
|
||||
lineHeight: "1.5",
|
||||
};
|
||||
|
||||
const containerStyle: CSSProperties = {
|
||||
width: "100%",
|
||||
maxWidth: `${theme.containerWidth}px`,
|
||||
margin: "0 auto",
|
||||
padding: theme.spacing.md,
|
||||
};
|
||||
|
||||
const cardStyle: CSSProperties = {
|
||||
backgroundColor: theme.colors.surface,
|
||||
border: `1px solid ${theme.colors.border}`,
|
||||
borderRadius: theme.radius,
|
||||
padding: theme.spacing.lg,
|
||||
};
|
||||
|
||||
const previewStyle: CSSProperties = {
|
||||
display: "none",
|
||||
fontSize: "1px",
|
||||
lineHeight: "1px",
|
||||
maxHeight: 0,
|
||||
maxWidth: 0,
|
||||
opacity: 0,
|
||||
overflow: "hidden",
|
||||
msoHide: "all",
|
||||
} as unknown as CSSProperties;
|
||||
|
||||
/**
|
||||
* Top-level email layout. Renders a 600px centred card. The `previewText`
|
||||
* is hidden but harvested by Gmail/Apple Mail as the inbox snippet.
|
||||
*/
|
||||
export function Layout({ previewText, title, children, footer }: LayoutProps) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charSet="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
{title ? <title>{title}</title> : null}
|
||||
</head>
|
||||
<body style={bodyStyle}>
|
||||
{previewText ? <div style={previewStyle}>{previewText}</div> : null}
|
||||
<div style={containerStyle}>
|
||||
<div style={cardStyle}>{children}</div>
|
||||
{footer ? <div style={{ padding: `${theme.spacing.md} 0`, color: theme.colors.muted, fontSize: "13px", textAlign: "center" }}>{footer}</div> : null}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
import type { CSSProperties, ReactNode } from "react";
|
||||
import { theme } from "../theme.js";
|
||||
|
||||
export function Heading({ children, level = 1 }: { children: ReactNode; level?: 1 | 2 | 3 }) {
|
||||
const sizes = { 1: "26px", 2: "20px", 3: "17px" } as const;
|
||||
const style: CSSProperties = {
|
||||
margin: `${theme.spacing.sm} 0`,
|
||||
color: theme.colors.text,
|
||||
fontSize: sizes[level],
|
||||
fontWeight: 600,
|
||||
lineHeight: "1.2",
|
||||
};
|
||||
if (level === 1) return <h1 style={style}>{children}</h1>;
|
||||
if (level === 2) return <h2 style={style}>{children}</h2>;
|
||||
return <h3 style={style}>{children}</h3>;
|
||||
}
|
||||
|
||||
export function Paragraph({ children }: { children: ReactNode }) {
|
||||
const style: CSSProperties = {
|
||||
margin: `${theme.spacing.sm} 0`,
|
||||
color: theme.colors.text,
|
||||
fontSize: "16px",
|
||||
lineHeight: "1.55",
|
||||
};
|
||||
return <p style={style}>{children}</p>;
|
||||
}
|
||||
|
||||
export function Spacer({ size = "md" }: { size?: keyof typeof theme.spacing }) {
|
||||
return <div style={{ height: theme.spacing[size] }} />;
|
||||
}
|
||||
|
||||
export interface ButtonProps {
|
||||
readonly href: string;
|
||||
readonly children: ReactNode;
|
||||
}
|
||||
|
||||
export function Button({ href, children }: ButtonProps) {
|
||||
const style: CSSProperties = {
|
||||
display: "inline-block",
|
||||
backgroundColor: theme.colors.primary,
|
||||
color: theme.colors.primaryText,
|
||||
padding: "12px 22px",
|
||||
borderRadius: theme.radius,
|
||||
fontWeight: 600,
|
||||
fontSize: "15px",
|
||||
textDecoration: "none",
|
||||
};
|
||||
return (
|
||||
<a href={href} style={style} target="_blank" rel="noreferrer">
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
export function Footer({ children }: { children: ReactNode }) {
|
||||
const style: CSSProperties = {
|
||||
color: theme.colors.muted,
|
||||
fontSize: "12px",
|
||||
lineHeight: "1.5",
|
||||
};
|
||||
return <div style={style}>{children}</div>;
|
||||
}
|
||||
Reference in new issue
Block a user