Skip to content

refactor: introduce a Feature component for the code-and-text rows - #227

Merged
magnus-madsen merged 1 commit into
masterfrom
refactor/feature-component
Aug 15, 2026
Merged

refactor: introduce a Feature component for the code-and-text rows#227
magnus-madsen merged 1 commit into
masterfrom
refactor/feature-component

Conversation

@magnus-madsen

Copy link
Copy Markdown
Member

Summary

  • Adds src/components/Feature.astro: one row of the front-page feature tour — a title, the Flix source as code, a codeLeft boolean for which side the snippet sits on, and the prose slotted in as plain <p>s. A named code slot takes anything that is not a single Flix snippet (the manifest row's two PlainSnippets, the test row's output under its code).
  • Rewrites the 21 feature rows in src/pages/index.astro to use it (about 500 lines fewer). The hero row and the full-width Datalog row are a different shape and are left as they were.
  • One rule in global.css (.feature-text > :last-child) gives plain paragraphs the trailing-margin trim Bootstrap only gives .card-text, so callers no longer need that class on every paragraph.

Behaviour

Desktop rendering is unchanged. codeLeft is order-md-first on the code column and the text is always first in the markup, so on phones every row now reads heading → text → code; the eleven code-left rows used to show a bare snippet above its own heading. If a pixel-for-pixel no-op on mobile is preferred, the component can emit the columns in swapped DOM order instead.

Verification

  • astro check clean, astro build succeeds.
  • Built dist/index.html before and after and compared each feature row's two columns as an unordered pair (whitespace collapsed, the three known class changes stripped): all 21 rows identical, rest of the page identical modulo the CSS hash, 11 rows carry order-md-first.
  • The prose was reflowed for the shallower indent with care not to break a line in the whitespace touching an inline element, since the Astro compiler drops the space there (the reason for the <code\n> style, cf. fix: restore spaces lost between inline elements #212). The check above caught one such break; it is fixed.

🤖 Generated with Claude Code

Every row of the feature tour on the front page was the same twelve lines
of Bootstrap grid and card markup around a snippet and a few paragraphs,
with the two columns swapped by hand every other row. Feature.astro takes
the title, the Flix source and a codeLeft boolean, and slots the prose; a
named "code" slot covers the two rows whose code column holds more than a
single snippet.

The text is always first in the markup and codeLeft is order-md-first on
the code column, so on a narrow screen every feature now reads heading,
text, code, where the code-left rows used to put a bare snippet above its
own heading. Desktop rendering is unchanged: the built index.html was
diffed before and after with the columns compared as an unordered pair.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@magnus-madsen
magnus-madsen merged commit 9934111 into master Aug 15, 2026
2 checks passed
@magnus-madsen
magnus-madsen deleted the refactor/feature-component branch August 15, 2026 07:28
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.

1 participant