Skip to content

Responsive card sizing and improved symbol legibility - #44

Open
TimBest wants to merge 1 commit into
mainfrom
claude/card-margins-shape-sizing-xv7yqk
Open

Responsive card sizing and improved symbol legibility#44
TimBest wants to merge 1 commit into
mainfrom
claude/card-margins-shape-sizing-xv7yqk

Conversation

@TimBest

@TimBest TimBest commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Refactored card sizing from a fixed max-height: 10vh constraint to a responsive min(26vw, 20vh) approach that scales cards appropriately across device sizes. This improves symbol legibility on phones (the primary constraint) while allowing cards to grow on larger screens. Also adjusted symbol box sizing and spacing throughout the UI for better visual consistency.

Key Changes

  • Card sizing: Changed from max-height: 10vh to width: min(26vw, 20vh) with height: auto, allowing cards to scale responsively while maintaining square aspect ratio. This results in ~86px cards on narrow phones (27px symbols) and ~180px on desktop (57px symbols).

  • Symbol box: Reduced SYMBOL_MARGIN from 5 to 2 units, increasing SYMBOL_SIZE from 35 to 38 units. This improves symbol visibility at small sizes (0.317x downscale vs 0.29x previously).

  • CSS selector specificity: Changed .card svg to .card-content > svg to avoid unintentionally resizing nested symbol SVGs within the card viewport.

  • Spacing adjustments:

    • Reduced card padding from 5px to 3px
    • Removed 20px margin from card SVGs
    • Changed board button margins from m-1 to m-0 and added 4px gap to board grid
    • Updated previous selection card margins and sizing
  • Image sizing: Updated .card img to use max-width and max-height with the same responsive sizing formula.

  • Card selector: Added responsive sizing for cards in the game editor's card selector using min(18vw, 8vh).

  • Documentation: Updated all references to card sizing in iconography guide, architecture docs, and deckBuilder README to reflect new measurements and the phone-first design approach.

  • Test utilities: Updated render-shape.mjs reference sizes from [60, 90, 140] to [90, 130, 180] to match actual responsive card sizes.

Implementation Details

The responsive sizing uses CSS min() to ensure cards never exceed viewport constraints while filling available space on narrow devices. The phone card (90px) is now the explicit reference point for symbol legibility checks, as it represents the worst-case scenario. The SYMBOL_SIZE constant is now exported from CardSvg.tsx for use in test utilities.

https://claude.ai/code/session_01Jt2TMy1ThEaBQPsfSN8cP3

Two layers of whitespace were shrinking every symbol: a 20px margin on the
card's svg (40px of a ~99px card) and a 5-unit gap around each symbol box.
Combined with a `max-height: 10vh` cap, a shape reached the player at ~17px on
a phone.

Drop `SYMBOL_MARGIN` to 2 (symbol box 35 -> 38 units), replace the svg margin
with 3px of card padding, and size the card at `min(26vw, 20vh)` so it fills
the board's three columns instead of being capped by viewport height. Shapes
now land at ~27px on a 330px-wide phone and ~57px on desktop.

Symbol size stays independent of shape count — `SYMBOL_SIZE` remains a single
constant and the count only selects which of the nine fixed slots are filled,
so one shape renders at exactly the size of each of nine. Verified in Chromium
at 320/330/360px and 1440px: identical symbol boxes at every count, no
horizontal overflow.

The card sizing rule has to be a child selector. `CardSvg` nests one <svg> per
symbol inside the root one, and a `.card svg` descendant selector applied the
width to those too — in user units, swelling each symbol to fill the card. The
old rule got away with it because `max-height: 10vh` exceeded the symbol box.

Also scope the two overrides that sized by height (the history strip and the
editor's four-column selector, which sits in a 500px modal), and refresh the
scale figures in the deckBuilder README and shape skill docs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jt2TMy1ThEaBQPsfSN8cP3
@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for imaginative-dieffenbachia-3400e7 ready!

Name Link
🔨 Latest commit e317084
🔍 Latest deploy log https://app.netlify.com/projects/imaginative-dieffenbachia-3400e7/deploys/6a6bf5d656b22400087d6061
😎 Deploy Preview https://deploy-preview-44--imaginative-dieffenbachia-3400e7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

2 participants