Skip to content

Latest commit

 

History

History
113 lines (96 loc) · 5.81 KB

DESIGN.md

File metadata and controls

113 lines (96 loc) · 5.81 KB

Design standards

Site-wide rules for Gradient. Interactive sandboxes have their own, stricter list in src/sandboxes/README.md. Above everything: keep it simple, keep it consistent everywhere, and use as few moving parts as possible.

Card mode and fullscreen: scale, never reflow

  • Every card's content is laid out once, at its card-mode size, and scaled as a whole to fit the card (InfoCard). Fullscreen shows the same layout, only bigger: text never re-wraps, nothing changes order or orientation, and the transition is a single smooth zoom.
  • The only thing allowed to change is position along an edge: pieces anchored to an edge (a sidebar, a corner control) translate out to the card's edge by the spare space InfoCard reports (--info-card-extra-x / -y), and centered content stays centered in the space that's left. A lecture's black screen stretches to the card's edges.
  • Never write fullscreen-only layout rules. If something needs one, anchor it to an edge or let it scale instead.

Corners

  • Anything aligned to a corner sits the same distance from both edges of the card, measured from what's actually drawn, not from empty padding.
  • The lesson plan toggle owns the top-left corner. Corner content (like a sandbox's network map) uses --lesson-card-corner-inset so it clears it.
  • The projector rope hangs near the top-right corner. On entries with a checklist, the checklist's toggle (the plan toggle's mirror) owns the corner itself, clear of the rope; nothing else goes there. The one exception is a passing note (a task or module done): it's only up for a moment, so it's drawn over everything, the rope included.

Graphs

  • Nothing plotted leaks past a graph's frame: curves, guide lines and shading are clipped to the inside of it.
  • A dot you drag (or any marker on a graph) is drawn on top of everything, the frame included, and never pokes past the frame: what's drawn reaches a little beyond the range the dot can move through, so even at its limits the dot sits fully inside with a few pixels to spare.

Text

  • Never use the middle dot ("·") anywhere on the site. Separate with a comma instead ("Layer 1, Neuron 1").
  • Text on a dark fill (a selected pill, a lecture's black bars, a tooltip, an ink-filled box) is paper-white, so it always reads.
  • Text that sits side by side lines up: every label in a row shares one center line, and every row of controls one baseline.

Shapes and bars

  • Circles stay circles: canvases and SVGs scale the same in both directions, never stretched to fit a box.
  • Progress bars run along an edge (a plan entry's bottom edge, the card's bottom edge) and have square ends, never rounded.

Color

  • Colors are site tokens in :root (src/components/Navbar.css), and code reads the tokens instead of copying hex values:
    • --class-a amber #d99a1e and --class-b plum #7a4f9a: the two classes in any two-class view.
    • --highlight cyan #1a9bb8: the currently selected thing.
    • --positive green #3b8a4a and --negative red #c4382f: signs, such as a network's weights. Lines stay solid in both colors.
    • In explanations, each weight's number takes its line's color (green if it adds, red if it subtracts), and the word "weight" is split corner to corner, green top-left and red bottom-right, since a weight can be either. A bias is orange (--bias #e0702a), as a word and as a number.
    • --line ink and --surface paper for everything else.
    • Right and wrong (a problem set's answers) are shown in ink, never in green and red, which mean a sign: a right pick's circle fills with ink as a check draws itself in, and a wrong pick gets a drawn cross and fades.
  • Each color means one thing everywhere. Data points are a lighter tint of their class color with a slightly darker border of the same hue.

Interaction and motion

  • Fold features into the thing itself instead of adding controls: a gesture on the object (drag, double-click), explained in its hover tooltip, beats a separate button or slider. Don't add buttons for things that already happen on their own.
  • Never change anything instantly. Every visible change animates: colors transition, things fade or slide in and out, numbers slide to their new value, and a canvas crossfades from its old picture to its new one. Selection pills slide between options with a slight rubber-band; hover highlights grow and fade in and out. Nothing just blinks on or off.
  • Actions on a thing (double-click to fold, its tooltip) belong to the drawn object, not the box around it: hit-test what's actually drawn (the sheet, not its canvas). Turning a view works anywhere in it, so it's easy to grab.
  • Text inside pills and buttons is exactly centered (all-caps labels are trimmed to their capital height).
  • Never show a focus outline on anything, anywhere on the site: not the browser's blue-and-white ring and not a ring of our own.
  • Everything comes back where it was left. A lesson card reopens on the entry it was last on, every reading and problem set at the same scroll, and every lecture at the second it was left, after switching entries, leaving the lesson, or reloading.

Lesson plan sidebar

  • Picking an entry (other than the intro) collapses the plan once the pointer reaches the main area, not before.
  • With the plan collapsed, resting the pointer right against the card's left edge opens it; it closes again back in the main area. It never opens while a button is held, right after a press or release, or when the pointer only sweeps past.
  • Opening the plan never shrinks the lesson's content when there's room: the content keeps its size and slides right, beside the plan. In fullscreen, content (lectures, sandboxes) reaches out to the card's edges, so it has that room. In card mode there's no spare space, so it fits beside the plan.