Skip to content

feat(alert): per-type colour treatment for Info/Success/Warning/Danger - #199

Merged
martinyde merged 1 commit into
developfrom
feature/issue-196-alert-colour-treatment
Jul 10, 2026
Merged

feat(alert): per-type colour treatment for Info/Success/Warning/Danger#199
martinyde merged 1 commit into
developfrom
feature/issue-196-alert-colour-treatment

Conversation

@martinydeAI

Copy link
Copy Markdown
Collaborator

Links to issues

Fixes #196

Leantime: https://leantime.itkdev.dk/dashboard/show#/tickets/showTicket/7675

Description

Completes the colour work deferred from #93. The shared Alert
component now renders four visually distinct types instead of a
single neutral surface.

  • assets/styles/app.css gains four semantic token triples under
    @theme--color-{info,success,warning,danger}-{surface,line,ink}
    — each picked to pass WCAG AA against its own soft surface.
    Success leans emerald so it reads as a status hue and not as a
    second brand-green accent.
  • templates/components/Alert.html.twig maps the type prop to
    the matching class triple; the deferred-treatment comment is
    dropped.
  • The type value is renamed from error to danger (no alias),
    and the nine existing type="error" callsites are updated.
  • ARIA behaviour is unchanged: warning/danger stay assertive
    (role="alert"), info/success stay polite (role="status").
  • New tests/Integration/Twig/Components/AlertRenderTest.php pins
    each type's class triple + role.

Screenshot of the result

To be added — please eyeball each of the four types locally before
merging.

Checklist

  • My code is covered by test cases.
  • My code passes our test (all our tests).
  • My code passes our static analysis suite.
  • My code passes our continuous integration process.

Details - AI specificities

Goal

Give users an at-a-glance read on message severity. Today an error
and a success notice render identically, undercutting the feedback.
#93 named the four types but shipped only the ARIA-role split,
deferring the colour treatment pending semantic tokens.

Scope

  • Add four semantic token triples to the @theme block in
    assets/styles/app.css.
  • Wire them through templates/components/Alert.html.twig.
  • Rename the type value errordanger and migrate the nine
    existing callsites.
  • New AlertRenderTest mirroring the pattern used for
    FilterPillRenderTest / FormButtonRenderTest.
  • Rebuild the Tailwind bundle.

Non-goals

  • No icons — the task list said "and any icon", but Alert has no
    icons today and none were introduced. Purely colour treatment.
  • No new alert call-sites and no change to where alerts are
    emitted — purely the visual treatment of the existing component.
  • No toast / dismissible / stacked-notification behaviour.

Decisions

  • Rename errordanger without an alias. Cleaner API,
    matches the design language named in the issue, and the nine
    callsites migrate in one sweep. Trade-off: any out-of-tree
    templates referencing type="error" (none exist in this repo)
    would need to be updated.
  • Success leans cool (emerald) rather than warm (green). The
    brand accent is --color-primary: #478523 (warm green-700).
    Using warm green for success would read as a second brand
    accent, which the constraint in feat(components): per-type colour treatment for Alert (Info / Success / Warning / Danger) #196 explicitly rules out.
  • Token naming follows the existing surface/line/ink
    convention
    (--color-surface-2, --color-line, --color-ink
    already exist), giving bg-*/border-*/text-* utilities that
    read cleanly at the call site.

Verification

  • task coding-standards-check → clean.
  • task test → 690 tests, 2044 assertions, all green.
  • Visual check pending — please load /reset-password, /login,
    /admin/settings/site, and /admin/user/list to see danger,
    success, and info surfaces in context.

Links

Add semantic `--color-{info,success,warning,danger}-{surface,line,ink}`
tokens under the @theme block in `assets/styles/app.css` and map the
Alert component's `type` prop to the matching class triple, replacing
the single neutral surface. Success leans emerald so it reads as a
status hue and not as a second brand-green accent. Rename the `type`
value from `error` to `danger` to match the design language and
update the nine existing callsites. ARIA behaviour is unchanged
(warning/danger assertive, info/success polite). Add
`AlertRenderTest` pinning role + class markers per type.

Fixes #196

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@martinyde
martinyde merged commit 2978994 into develop Jul 10, 2026
7 checks passed
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.

feat(components): per-type colour treatment for Alert (Info / Success / Warning / Danger)

2 participants