feat(widgets): size-aware block variants - #23
Merged
Merged
Conversation
- Per-type renderers in shared/widget/blocks/ chosen by size family (tiny 1x1, strip 2-3x1, wide 4x1, card, large); the previous designs become the card variant - New layouts: 1x1, 2x1 and 4x1 for every data block, 4x2 for the GitHub profile and LeetCode; text fits itself to any size - Shared parts: BigStat, SegmentBar, Avatar, fitFontSize, wrapText; compact 'add a username' state for small blocks - BLOCK_SIZES gains compact sizes (legacy sizes kept for migrated widgets); text defaults to 2x1; new blocks fall back to smaller sizes when the default does not fit - Fix: layout updates were capped at 5 blocks - Tests render every block in every allowed size
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
4 tasks done
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.
Step 3 of the grid refactor. Stacked on #22 (merge #22 and this together).
Summary
Blocks now have purpose-built layouts per size instead of one design.
Architecture:
server/src/shared/widget/blocks/has one renderer per block type, chosen by size family (blockVariant):tinystripwidecardlargecardwhere not designedNew layouts:
The full table is in
docs/design/grid-and-blocks.md.Shared parts:
BigStat,SegmentBar,Avatar,fitFontSize,wrapText, plus a compact "add a username" state for small blocks.Sizes: compact sizes added to
BLOCK_SIZES; the legacy doubled sizes stay so migrated widgets remain valid. Text defaults to 2×1.Placement: a new block that doesn't fit at its default size uses the largest smaller allowed size that does. Previously a widget with four 2×2 blocks refused a 5th block even though the limit is 8.
Fix: the layout update schema still capped saves at 5 blocks. Also pushed to #22.
Test plan
blockVariants.test.tsxrenders every block in every allowed size (52 cases: expected data present, noNaN/undefined); placement fallback; 8-block layout saveformat:check,lint,typecheck,test(54 client + 177 server),build,typecheck:api