fix: stop overriding template .card layout in gallery + editor preview#2487
Merged
Conversation
Last commit added `body > .card { display: flex; ... padding: 16px;
text-align: center }` with specificity 0,1,1 — higher than templates'
own `.card { display: flex; ... padding: 32px 24px }` (0,1,0). Result:
every template that had its own centering lost it, and the 16px padding
clipped large-text designs (Clean Basic right edge, Alex Deluxe
wrapping into clipped second lines).
Wrap the default layout rule in `:where(body > .card)` so the
specificity drops to 0,0,0. Templates with their own `.card` rules win
automatically. Templates without — Default, Only Notion, Raw Note,
Minimal — still get flex-column centering as a fallback. Drop the
padding entirely; the template owns padding.
Hit on the live editor preview at /templates/edit/vocab-language
(Vocab's `display: flex; align-items: center` was being stomped) as
well as the gallery thumbnails.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for notion2anki ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
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
The previous fix (#2486) added `body > .card { display: flex; ... padding: 16px; text-align: center }` to the iframe wrapper. That selector is specificity 0,1,1 — higher than templates' own `.card { ... }` (0,1,0) — so it stomped every template that had its own centering and padding.
Visible breakage
What changes
One line in `renderNoteTypePreview.ts`: wrap the default `.card` layout rule in `:where(body > .card)` (specificity drops to 0,0,0). Templates' own `.card` rules now always win. Templates without a `.card` display rule (Default, Only Notion, Raw Note, Minimal) still get flex-column centering as the fallback. Padding removed — that's the template's call.
Test plan
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.