Files
outline/server/emails/templates/components/EmailLayout.tsx
T
Tom MoorandClaude Fable 5 b17f2611bf chore: React 18 upgrade (#13559)
* React 18 upgrade

* fix: Force synchronous React rendering in server HTML export

React 18 can defer a legacy ReactDOM.render commit when sync work is
queued, leaving exported component nodes empty. Wrap the render in
flushSync, and flush unmount-scheduled passive effects before global
env cleanup so React never runs without a window.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* refactor: Move server ComponentView to createRoot

ReactDOM.render and unmountComponentAtNode are removed in React 19.
flushSync around root.render keeps the mount synchronous for the
HTML-export path, which reads the DOM immediately after.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Enable CI

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-03 01:43:47 -04:00

90 lines
2.0 KiB
TypeScript

import { Table, TBody, TR, TD } from "oy-vey";
import * as React from "react";
import theme from "@shared/styles/theme";
const EmailLayout: React.FC<
React.PropsWithChildren<{
bgcolor?: string;
previewText: string;
goToAction?: { url: string; name: string };
}>
> = ({ previewText, bgcolor = "#FFFFFF", goToAction, children }) => {
let markup;
if (goToAction) {
markup = JSON.stringify({
"@context": "http://schema.org",
"@type": "EmailMessage",
potentialAction: {
"@type": "ViewAction",
url: goToAction.url,
name: goToAction.name,
},
});
}
return (
<>
{markup ? (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: markup }}
/>
) : null}
<Table
bgcolor={bgcolor}
id="__bodyTable__"
width="100%"
style={{
WebkitFontSmoothing: "antialiased",
width: "100% !important",
background: `${bgcolor}`,
WebkitTextSizeAdjust: "none",
margin: 0,
padding: 0,
minWidth: "100%",
}}
>
<TR>
<TD align="center">
<span
style={{
display: "none !important",
color: `${bgcolor}`,
margin: 0,
padding: 0,
fontSize: "1px",
lineHeight: "1px",
}}
>
{previewText}
</span>
<Table width="550">
<TBody>
<TR>
<TD align="left">{children}</TD>
</TR>
</TBody>
</Table>
</TD>
</TR>
</Table>
</>
);
};
export default EmailLayout;
export const baseStyles = `
#__bodyTable__ {
font-family: ${theme.fontFamily};
font-size: 16px;
line-height: 1.5;
}
@media (prefers-color-scheme: dark) {
.email-button {
background: #FFFFFF !important;
color: #000000 !important;
}
}
`;