Skip to content

Fit the union-find forest on phones - #110

Open
A7med7x7 wants to merge 2 commits into
mainfrom
autopilot/fit-union-find
Open

A7med7x7 wants to merge 2 commits into
mainfrom
autopilot/fit-union-find

Conversation

@A7med7x7

Copy link
Copy Markdown
Member

From the 390 px audit in #78: the "Union-find (disjoint sets)" lab in Data Structures union-find was 110 px too wide.

Why

The lab starts with 8 one-node sets. The layout left the same 0.4-column gap after every set as after a full tree, so the starting drawing was 513 units wide, with an inline minimum width of 410 px.

Fix

  • Single-node sets take a smaller gap (0.15 column), so the starting drawing is 407 units wide. The nodes still read as eight separate sets.
  • The minimum width applies from sm up only. It depends on the drawing, so it's passed through a CSS variable (sm:min-w-[var(--uf-min)]).
  • Larger node labels on phones (16 user units instead of 13).
  • Centred: node positions now span the full drawing width. Before, the row sat slightly left of centre on desktop too.

Checked

Playwright at 390 px (light and dark) and 1280 px, in the starting state and after "join everything": 0 px overflow, screenshots checked.

Smallest label Smallest node (tap target)
Phone, start 15 px 24 px
Phone, joined 20 px 34 px
Desktop 22 px 44 px

npm run lint: 0 errors. npm run test: all pass. npm run build: OK.


Generated by Claude Code

The union-find lab starts with eight one-node sets, spaced as if each
were a tree, so the drawing was 513 units wide with a 410 px minimum:
110 px wider than a 390 px phone. Single-node sets now take a smaller
gap, the minimum width applies from sm up (through a CSS variable,
since it depends on the drawing), and node labels use a larger font
on phones. The positions now span the drawing's full width, so the
forest is centred instead of sitting slightly left.

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

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.

2 participants