Skip to content

feat(templates): add Mailbag newsletter template (newsletter-mailbag) - #428

Open
Saifjafri212213 wants to merge 1 commit into
codercops:devfrom
Saifjafri212213:fix/410-newsletter-mailbag
Open

Saifjafri212213 wants to merge 1 commit into
codercops:devfrom
Saifjafri212213:fix/410-newsletter-mailbag

Conversation

@Saifjafri212213

Copy link
Copy Markdown
Collaborator

Description

Adds the Mailbag newsletter template (newsletter-mailbag) in the Newsletter category, as requested in #410.

How it works:

  • New template src/templates/newsletter/mailbag.ts (id: 'newsletter-mailbag'):
    • Header row with newsletter site name on top left and issue number on top right
    • Fixed "Mailbag" pill under the header in accent tone
    • Auto-scaling issue title with single-line ellipsis truncation
    • Up to three reader question rows stacked below the title, each with an accent-bordered "Q" circle, the question text, and the asker's name in muted tone on the right
    • Blank questions cleanly drop their entire row (including the asker) and the remaining rows close up
    • If all three questions are blank, the question list is completely omitted and the title sits cleanly below the header
    • Blank askers allow questions to utilize the full row width
    • Long questions and askers truncate with an ellipsis on one line, ensuring the question maintains majority width
    • Empty siteName or issue leaves no gap in the header, and an empty header row is omitted entirely
    • Adaptive contrast support for light backgrounds via isLightColor() and mixColors() so the pill, Q circles, and askers stay readable
  • Unit test suite tests/templates/mailbag.test.ts (10 tests) covering registration, defaults, dropped question rows, all blank questions, blank asker width expansion, title auto-sizing, question and asker truncation, empty header fields, and light background readability.
  • Re-exported in src/templates/newsletter/index.ts and registered in the newsletter block of src/templates/registry.ts.

Closes #410

How I Tested This

  • npx vitest run tests/templates/mailbag.test.ts → 10/10 tests passed
  • npm test → 112 test files, 2152/2152 tests passed
  • PREVIEW_FILES=src/templates/newsletter/mailbag.ts npx vitest run tests/templates/previews.test.ts → rendered all 4 variants (defaults, empty, light, long)
  • npx tsc --noEmit → 0 errors

AI Assistance

Antigravity for layout structure, Satori element hierarchy, and unit test coverage.

Type of Change

  • New template
  • Bug fix
  • New feature
  • Documentation
  • Tests
  • Refactoring
  • Performance improvement

Checklist

  • This PR targets dev
  • I was assigned the linked issue
  • npm run check / tsc --noEmit passes
  • npm run test passes
  • New templates follow the Template Guidelines

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the Mailbag newsletter template (newsletter-mailbag)

1 participant