feat(demo): add newsletter web archive example (#22)#51
Open
rajarshidattapy wants to merge 1 commit into
Open
Conversation
Renders the existing NewsletterDigest content as a standalone web page with <Page>, from the same component tree as the email. - NewsletterDigest exports newsletterTemplate(output), which swaps only the root wrapper: <Email> for inboxes, <Page> for the browser archive. Everything between the wrapper tags is shared — the footer links are the one intentional difference. - NewsletterWebArchive is the web variant, registered in the template showcase with mode "web". - New "Send the email, publish the archive" section renders both outputs side-by-side with the code that produces them. - useRenderTemplate now honours the entry's declared mode instead of always rendering as email.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a newsletter web archive example: the existing
NewsletterDigestcontent rendered as a standalone web page with<Page>, from the same component tree as the email.Closes #22.
Changes
templates/NewsletterDigest.tsx— extractednewsletterTemplate(output), which swaps only the root wrapper (<Email>→ tables for inboxes,<Page>→ div/flexbox for the browser). Everything between the wrapper tags is shared; the footer links are the one intentional difference (Unsubscribe · View in browservsSubscribe · Browse the archive).templates/NewsletterWebArchive.tsx— new: the web variant, registered in the template showcase withmode: "web"so it gets Preview / Code / HTML / Plain Text tabs.sections/NewsletterArchiveDemo.tsx— new "Send the email, publish the archive" section rendering both outputs side-by-side with the code that produces them.hooks/useRenderTemplate.ts— honour the entry's declaredmodeinstead of always rendering as email (one line; was a latent bug for any non-email entry).Test Plan
pnpm buildpassespnpm testpasses (450 tests, 36 files)Notes
Demo-only change; no library code touched. CI type-checks the demo via
tsc -binpnpm build.Verified the section live in Chromium: both iframes render, no console errors. I also ran a throwaway parity check confirming email emits
<table>, web emits none, both carry identical article content, andNewsletterWebArchive()matchesnewsletterTemplate("web")byte for byte — then deleted it.