Skip to content

feat(templates): add Two Takes quote template (quote-two-takes) - #426

Merged
anurag629 merged 2 commits into
codercops:devfrom
Saifjafri212213:fix/411-quote-two-takes
Nov 19, 2026
Merged

anurag629 merged 2 commits into
codercops:devfrom
Saifjafri212213:fix/411-quote-two-takes

Conversation

@Saifjafri212213

Copy link
Copy Markdown
Collaborator

Description

Adds the Two Takes quote template (quote-two-takes) in the Quote category, as requested in #411.

How it works:

  • New template src/templates/quote/two-takes.ts (id: 'quote-two-takes'):
    • Topic title across the top with auto-scaling font size via autoFontSize() and single-line ellipsis truncation
    • Two equal quote columns split by a thin vertical divider with a centered circular "vs" chip
    • Left column label uses accentInk / accent color pill and right column uses muted text tone
    • Font size for both quotes is synchronized based on the longer of the two using autoFontSize() so columns stay balanced
    • Optional author bylines truncate cleanly on one line with ellipsis
    • Blank quotes safely fall back to default text; blank title/label/author/siteName leave no awkward gap
    • Full adaptive contrast support for light backgrounds via isLightColor() and mixColors()
  • Unit test suite tests/templates/two-takes.test.ts (12 tests) covering registration, defaults, fallback quotes, omitted fields, quote truncation, synchronized font sizing, title scaling, light background readability, and "vs" chip rendering.
  • Re-exported in src/templates/quote/index.ts and registered in the quote block of src/templates/registry.ts.

Closes #411

How I Tested This

  • npx vitest run tests/templates/two-takes.test.ts → 12/12 tests passed
  • npm test → 110 test files, 2126/2126 tests passed
  • PREVIEW_FILES=src/templates/quote/two-takes.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

@anurag629 anurag629 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Saifjafri212213, nice work, the two columns stay the same width in all four previews, both quotes share one size, and the long case truncates the quotes, bylines and site name without pushing anything off the card. The chip and labels read fine on the light background too.

A few things before I can merge:

  1. A blank label falls back to "Yes"/"No" (src/templates/quote/two-takes.ts:101 and :102), so the empty preview still shows both pills. #411 asks for a blank label to leave no gap, so please drop the fallback and skip the pill when the label is blank, the way the byline is skipped at :176, and add a test for it.
  2. The quotes come out at 30px in the defaults, because the longer one is 61 characters and just misses the 60 step at :91. That leaves close to 300px of empty space between each quote and its byline. #411 asks for the quote in large type and each column has the room, so please move the steps up, something like 40px up to 70 characters, then 34, 28 and 24px for the 220 cap.

Everything else looks good.

@Saifjafri212213

Copy link
Copy Markdown
Collaborator Author

Thanks for the review @anurag629! I've addressed both points in b9a0acf:

  1. Omit pills when label is blank: Dropped the fallback to "Yes"/"No" on blank labels so pills are omitted cleanly with no empty gap, and added a unit test verifying this.
  2. Quote font size scaling: Moved the font size steps up to 40px (up to 70 chars), 34px (up to 120 chars), 28px (up to 170 chars), and 24px (up to 220 chars). The default quotes now render at 40px.

All unit tests (14/14), full test suite (2128/2128), preview renders, and type checks pass cleanly.

@anurag629 anurag629 added the codercops-accepted Merged PR that counts on the monthly leaderboard (oss.codercops.com) label Nov 19, 2026
@anurag629
anurag629 merged commit 6253ffb into codercops:dev Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codercops-accepted Merged PR that counts on the monthly leaderboard (oss.codercops.com)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the Two Takes quote template (quote-two-takes)

2 participants