Skip to content

Add DESIGN.md, fix SCSS entry-point import order, correct docs examples - #245

Open
daphneslootmans wants to merge 8 commits into
masterfrom
design-system-docs
Open

Add DESIGN.md, fix SCSS entry-point import order, correct docs examples#245
daphneslootmans wants to merge 8 commits into
masterfrom
design-system-docs

Conversation

@daphneslootmans

@daphneslootmans daphneslootmans commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Why

The bundle ships the shared admin theme every project inherits, but nothing stated its design decisions in one place. Working that out meant reading 1763 lines of Sass variables to separate deliberate choices from stock Bootstrap. Establishing that reference turned up three real defects, fixed here alongside it.

What changed

fix: SCSS entry-point import order

error.scss and mail.scss imported Bootstrap's variables before bootstrap-variables. Both sides use !default, so the vendor value won and every bundle override was silently inert — error pages and emails rendered with stock Bootstrap tokens.

error.scss also never imported bootstrap-variables-dark, yet base_error.html.twig includes settheme.html.twig and so does get data-bs-theme. The dark custom properties were never emitted while base/_error.scss reads var(--error-bg) and var(--error-content-bg), so dark error pages used light colours.

This is the only behavioural change in the PR.

docs: DESIGN.md

New reference at the repo root in the designmd.ai format, linked from docs/index.md. Every value diffed against stock Bootstrap 5.3.3 so only deliberate decisions are recorded. Includes the card-based page composition rule, a 37-entry partial inventory matching _imports.scss, and 11 open questions recorded rather than fixed.

docs: crud.md template inheritance

The three page examples extended 'layout.html.twig' and filled {% block content %}. Neither exists — layout.html.twig is absent from application-skeleton and every sibling project, and the bundle's base.html.twig defines main, not content. Examples now also follow the card composition rule.

docs: twig-cs-fixer errors

All 16 twig snippets across docs/ now lint clean (was 9 errors in 5 files).

Verification

Bootstrap is not installed in this repo, so the SCSS was compiled by symlinking a sibling project's vendor/twbs into a fake vendor tree. All three entry points compile clean: style.scss 434KB, error.scss 280KB, mail.scss 34KB.

Before/after on the compiled error.css:

before after
--bs-border-radius 0.375rem (stock) 0.25rem
--bs-gray-900 #212529 (stock) #2d2f35
--bs-body-bg #fff (stock) #f8f9fa
pill buttons 0 3
Lato absent present
dark --error-bg absent #4B6376

mail.css changed by exactly 4 lines: $dark-gray now resolves to #383a43 instead of stock #212529.

Documentation accuracy was checked mechanically: every file path resolves, 10 spot-checked values trace to real source lines, the inventory count matches _imports.scss exactly (37 = 37), and each twig snippet was extracted to a real .twig file and linted. sumo hooks:check passes on all changed files. The bundle's own 23 templates still lint clean.

Test plan

  • Open an error page (404/403) in light mode and confirm it picks up the bundle theme — tighter radii, darker greys, pill buttons, Lato
  • Open an error page in dark mode and confirm the background is #4B6376 rather than the light #b2cadd
  • Send a test email and confirm body/subheader text reads #383a43
  • Confirm no visual regression on a normal admin page (style.scss is unchanged by this PR)

Error pages and emails visibly change appearance. That is the intended correction, but it is a change to live output and deserves a look in a browser and a real test email.

Notes for review

  • The card composition rule in DESIGN.md is a new standard, not a description of current code. Existing templates in consuming projects put form rows straight into {% block main %}. The doc says to treat those as unconverted rather than counter-examples. No consuming project is changed here.
  • Three latent bugs are recorded as open questions rather than fixed, to keep this PR scoped: the dead $white: #e1e1e1 in the dark variables file (proven dead — #e1e1e1 appears zero times in 434KB of output), the undeclared --user-bg consumed by .user-nav at layouts/_header.scss:22, and twbs/bootstrap being an undeclared peer dependency.

🤖 Generated with Claude Code

Summary by Sourcery

Document the admin design system and correct theme compilation, component styling, and documentation examples.

Bug Fixes:

  • Correct SCSS entry-point ordering so bundle theme overrides apply to error pages and emails, and include dark-mode error tokens.
  • Restore compiled table striping, hover, and active row styling across themes.
  • Add dark-mode form focus styling for adequate visibility.

Enhancements:

  • Document the bundle’s design system, component inventory, layout conventions, dark mode, accessibility guidance, and open design questions.

Documentation:

  • Link the new design-system reference from the documentation index.
  • Correct CRUD template examples to use the actual base template, main block, and card-based page composition.
  • Fix Twig coding-standard violations and formatting in documentation examples.

Daphne Slootmans and others added 4 commits September 11, 2026 10:16
…oints

error.scss and mail.scss imported vendor/twbs/bootstrap/scss/variables before
bootstrap-variables. Both sides use !default, so the vendor value won and every
override in bootstrap-variables was silently inert: error pages and emails
rendered with stock Bootstrap tokens instead of the bundle's.

Reordering restores them. Verified by compiling against Bootstrap 5.3.3:
error.css now emits --bs-border-radius 0.25rem (was the stock 0.375rem),
--bs-gray-900 #2d2f35 (was #212529), --bs-body-bg #f8f9fa (was #fff), pill
buttons and Lato; mail.css picks up $dark #383a43 for body and subheader text.

error.scss also now imports bootstrap-variables-dark. base_error.html.twig
includes settheme.html.twig, so error pages do get data-bs-theme, but the dark
custom properties were never emitted and base/_error.scss reads var(--error-bg)
and var(--error-content-bg). Dark error pages used light colours.

mail.scss deliberately omits the dark file: Foundation for Emails has no colour
modes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Single reference at the repo root, in the designmd.ai format, describing the
shared admin theme every project inherits. Linked from docs/index.md.

Values were reverse-engineered from assets/scss and templates, then diffed
against stock Bootstrap 5.3.3 so only deliberate decisions are recorded. Covers
colours (including the non-stock ninth "white" theme colour), the compressed
and RFS-fluid type scale, spacing, the sidebar/topbar shell, elevation, the
pre-5.3 focus model, a full 37-entry partial inventory matching _imports.scss,
dark mode, and the conventions for changing any of it.

Also documents the card-based page composition rule: everything inside
{% block main %} sits in a card, one card per section or per overview item,
separated with mb-3 or a gy-3 row, and tables keep their card-body.

Eleven open questions are recorded rather than fixed, including the dead
$white: #e1e1e1 in the dark variables file, the undeclared --user-bg consumed
by .user-nav, and twbs/bootstrap being an undeclared peer dependency.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The three page examples extended 'layout.html.twig' and filled
{% block content %}. Neither exists: layout.html.twig is absent from
application-skeleton and every sibling project, and the bundle's
base.html.twig defines main, not content. Only Mail/base.html.twig defines a
content block. Corrected to extend 'base.html.twig' and fill {% block main %},
with a note recording the real chain so the error does not recur.

Examples now follow the card composition rule: table and pagination in one
card > card-body, each form in its own card. Tables keep the card-body because
a list section usually carries a title or intro text alongside the table.

Also fixes four twig-cs-fixer errors in the delete-form example: the padded
hash literal and a missing trailing comma on the stimulus_controller parameter
list.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every twig snippet in docs/ now lints clean (16 snippets, 0 errors), verified
by extracting each fenced block to a real .twig file and running the project's
twig-cs-fixer config.

- stimulus.md: unpadded the hash literal in the delete-form example and added
  trailing commas to both stimulus_controller parameter lists
- pagination.md: {% include %} tag replaced with the include() function
- language-switch.md: dropped unnecessary quoting of the _locale hash key
- mails.md: removed trailing whitespace on two lines

The pagination.md and language-switch.md edits change code rather than
whitespace; both are exact Twig equivalents with no behaviour change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

The PR fixes inert theme overrides in error and mail SCSS entry points—also restoring dark error-page tokens—while adding a comprehensive DESIGN.md reference, correcting CRUD template examples to match the bundle's inheritance and card conventions, and making documentation Twig snippets lint clean.

Flow diagram for corrected SCSS entry-point import order

flowchart LR
    F[Bootstrap functions] --> O[Bundle variable overrides]
    O --> D[Dark-mode overrides]
    D --> V[Bootstrap variables]
    V --> VD[Bootstrap dark variables]
    VD --> I[Selective Bootstrap imports]
    I --> C[Bundle components and layouts]
    C --> CSS[Compiled theme CSS]
Loading

File-Level Changes

Change Details Files
Correct SCSS entry-point load order so bundle overrides are consumed by Bootstrap, and enable dark-mode tokens for error pages.
  • Move light and dark bundle variables before Bootstrap variables in error.scss.
  • Move light bundle variables before Bootstrap variables in mail.scss.
  • Add bootstrap-variables-dark to the error entry point while keeping it out of mail.scss.
  • Document the load-bearing import order and resulting theme behavior.
assets/scss/error.scss
assets/scss/mail.scss
DESIGN.md
Add a repository-level design-system reference covering tokens, composition, architecture, and maintenance conventions.
  • Document deliberate deviations from Bootstrap 5.3.3 across colors, typography, spacing, layout, components, dark mode, motion, and accessibility.
  • Inventory all imported SCSS partials and identify authored-but-unimported partials.
  • Record implementation constraints, import-order rules, contribution guidance, and scoped open questions.
  • Link the new reference from the documentation index.
DESIGN.md
docs/index.md
Update CRUD documentation examples to use the bundle's actual template hierarchy and card-based page composition.
  • Replace the nonexistent layout.html.twig/content blocks with base.html.twig/main blocks.
  • Wrap table, form, and delete-form examples in card/card-body containers.
  • Clarify inheritance, available header blocks, and table/card guidance.
docs/crud.md
Apply Twig CS fixer-compatible syntax and formatting throughout documentation snippets.
  • Normalize Twig include and expression syntax.
  • Add required trailing commas in multiline function arguments.
  • Remove whitespace-only formatting issues.
docs/language-switch.md
docs/mails.md
docs/pagination.md
docs/stimulus.md
docs/crud.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Daphne Slootmans and others added 4 commits September 11, 2026 10:46
$table-striped-bg was var(--bs-emphasis-color), a solid colour, where stock is
rgba(var(--bs-emphasis-color-rgb), $table-striped-bg-factor). The factor was
still declared at 0.05 directly above it but never used, so the rgba wrapper
and the -rgb suffix had been dropped.

--bs-emphasis-color resolves to #000 in light mode and #fff in dark, so plain
.table-striped rendered solid black odd rows (solid white in dark) instead of a
5% tint. Only the .table-{color} variants computed sane values. docs/crud.md
prescribes <table class="table">, so this was one class away from being hit.

Compiled output now emits rgba(var(--bs-emphasis-color-rgb), 0.05), and the
diff against the previous build is that single line.

DESIGN.md updates alongside it:

- drops the $table-striped-bg open question, now fixed, and records the
  corrected behaviour in the Tables section
- rewords the $variable-prefix entry. It is not a defect: the fork defines
  $variable-prefix: bs- at :392 with $prefix: $variable-prefix on the next
  line, and the compiled CSS emits var(--bs-font-sans-serif) correctly. It is
  a deprecated name still wired up, worth renaming before an upstream release
  drops the alias
- adds an open question for $table-hover-bg and $table-active-bg, which use
  rgba($black, ...) instead of the emphasis-color-rgb var and so darken in
  dark mode rather than lightening
- removes all 17 em dashes to match the house style and the rest of docs/

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two defects found by rendering the theme in a real project.

Table striping, hover and active never worked, in either theme.

Three causes stacked. $table-accent-bg was $white where stock is transparent.
Bootstrap 5.3 paints every cell with
box-shadow: inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type,
var(--bs-table-accent-bg))), so that white fallback flooded all cells. The
flood was then masked with a blanket

    > :not(caption) > * > * { box-shadow: none; }

in components/_tables.scss. That shadow is the row-state mechanism itself, so
clearing it disabled striping, hover and active along with the flood.

$table-accent-bg goes back to transparent and the blanket reset is removed.
The thead reset stays, so headers remain flat. Combined with the earlier
$table-striped-bg fix, odd rows now render a 5% tint that follows the theme.

This also explains $table-active-bg-factor: 0.75 against a stock 0.1. It was
never visible. Now that active rows paint, it shows as a near-black overlay.
Left as an open question rather than guessed at.

Focus was invisible in dark mode.

$input-focus-border-color is a hardcoded #495057 with an rgba($black, .17)
glow and there was no dark-mode override at all. Against the #383a43 dark
surface both disappear, failing WCAG 2.4.7. components/_forms.scss now
inverts the pair under color-mode(dark): a $gray-400 #ced4da border with an
rgba($white, .25) glow.

Both fixes change rendering for every project on this bundle, tables most of
all, since striping and hover have not worked until now.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
$table-hover-bg is rgba($black, 0.075) rather than stock's
rgba(var(--#{$prefix}emphasis-color-rgb), $table-hover-bg-factor), so hover
darkens in dark mode instead of lightening and reads faint on a dark row.
Reviewed and kept deliberately.

Moves it out of the open questions list into the Tables section, where it
belongs as a documented decision with a note not to "fix" it to the stock
expression unasked. Open questions now holds only genuinely open items.

$table-active-bg shares the hardcoded form and its 0.75 factor against a stock
0.1 stays open, tracked separately from this hover decision.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
$table-hover-bg and $table-active-bg were rgba($black, ...) where stock uses
rgba(var(--#{$prefix}emphasis-color-rgb), ...), so both darkened in dark mode
instead of lightening: hover was near-invisible on a dark row.

$table-active-bg-factor moves from 0.75 to the stock 0.1 as part of the same
change, not as a separate cleanup. Restoring the theme-aware form while leaving
0.75 would have made it worse, turning active rows into a 75% white wash in
dark mode instead of a 75% black one in light.

All three row states are now stock and in a sensible order of prominence:
striped 5%, hover 7.5%, active 10%, each a tint of --bs-emphasis-color-rgb.
Verified in a real project build, with no hardcoded rgba(0, 0, 0, ...) left in
any of the three.

These values were unobservable until the row-state box-shadow reset was removed
earlier in this branch, which is why the 0.75 had gone unnoticed.

DESIGN.md drops the accepted-deviation note on hover and the open question on
active, since neither describes the code any more, and records the row-state
tints as stock.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comment thread DESIGN.md
application's vendor tree. `twbs/bootstrap` and `twbs/bootstrap-icons` are not in this bundle's
`composer.json`; the application supplies them.

Everything below is a deliberate deviation from stock Bootstrap 5.3.3. Stock values are not

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nuttig om zo heel specifiek 5.3.3 te vermelden. Ik kan me inbeelden dat dat snel kan veranderen. Zou enkel Bootstrap 5 vermelden.

Comment thread DESIGN.md
`$secondary: $gray-600` `#6c757d`, `$dark: $gray-800` `#383a43` (stock points at `$gray-900`).
The bundle ships a neutral base and expects the application to override `$primary`.

`$theme-colors` carries a **ninth, non-stock entry: `"white": $white`**. Every

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is dat effectief in gebruik? Want anders lijkt me dat heel veel gedoe voor weinig meerwaarde?

Comment thread DESIGN.md
Buttons are pills at `30px`; everything else uses the tighter `0.25rem`. The shadow is a flat
ambient glow with no y-offset, not Bootstrap's lifted drop shadow.

**Focus.** The bundle keeps Bootstrap 5.2's focus model rather than 5.3's `$focus-ring-*`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventueel moet dit (later) ook eens herbekeken worden?

Comment thread DESIGN.md
`mb-3` / `gy-3` between them.
- Edit compiled CSS in the application's `public/assets/`.

## Open questions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moeten al die TODO's niet eens nagekeken worden?

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