Skip to content

Add a status component to the examples design system - #231

Open
jwrosewell wants to merge 2 commits into
mainfrom
feature/examples-status-component
Open

Add a status component to the examples design system#231
jwrosewell wants to merge 2 commits into
mainfrom
feature/examples-status-component

Conversation

@jwrosewell

Copy link
Copy Markdown
Contributor

Adds a status component to the examples layer of the design system, so
an example reporting the outcome of a check uses house classes rather
than its own inline colours.

Why

The 51Did creator context example (51Degrees/cloud#224) reports one
outcome per check and a single overall verdict. The examples layer has
an alert, a table, a form, a map, a layout and a message, but nothing
for "this check passed" or "this check failed", so the example would
have carried its own colours in a <style> block and drifted from the
design system the moment either changed.

What

06-examples/07-status.scss, with four states rather than two:

Class Meaning Colour
.c-eg-status--pass The check matched $colour-lime-darker
.c-eg-status--fail The check ran and did not match $colour-red
.c-eg-status--part Some checks held and others did not $colour-orange
.c-eg-status--none Nothing to judge, or still running $colour-grey-darker, unweighted

Two of those states need explaining. A check that could not be judged
on the connection is not a failure, so it is grey and deliberately
unweighted, which stops a reader scanning a column from reading an
absence as an outcome. A verdict where some checks held and others did
not is not the same as one where nothing held, so it is amber rather
than red. An example that only ever passes or fails uses the first two
and ignores the rest.

There is also .c-eg-value for identifiers and other verbatim strings,
which have to wrap rather than stretch the table they sit in.

No new tokens. Every colour comes from the existing palette in
00-abstract/00-colours.scss.

Checked

Built with npm run build:css in pattern-library. The rest of
examples-main.min.css is byte-identical to the copy currently
vendored in the example repositories, and the file grows from 12,215 to
12,553 bytes, so this adds the component and changes nothing else.

Written with AI assistance and needs human review before merge.

The 51Did creator context example reports one outcome per check and an
overall verdict, and there was nothing in the examples layer to style
that, so it would have carried its own colours inline and drifted from
the design system.

Four states rather than two, because a pass and a fail do not cover
what these examples report. A check that could not be judged on the
connection is not a failure, so it is grey and unweighted, and a
verdict where some checks held and others did not is not the same as
one where nothing held, so it is amber. An example that only ever
passes or fails uses the first two states and ignores the rest.

Colours come from the existing palette, being lime-darker, red,
orange and grey-darker, so nothing new enters the token set. A value
class is included for identifiers and other verbatim strings that have
to wrap rather than stretch the table they sit in.

Written for the 51Did example but named generally, so any example
reporting a pass or a fail uses it rather than inventing its own.
@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview 👀

@jwrosewell

Copy link
Copy Markdown
Contributor Author

Rollout note, so the vendored copies do not drift.

These assets are consumed as a vendored build, not as a live link. The device detection and IP intelligence example repositories carry fifteen copies of examples-main.min.css, all byte-identical to the examples-assets-v1.1.0 release, and common-ci's steps/update-example-assets.ps1 is what refreshes every committed copy from the latest examples-assets-v* release.

So this change reaches consumers only when a new examples-assets-v* release is cut after merge. Until then no repository should vendor a locally built copy, because that puts one repository ahead of the rest, which is exactly what I had done and have now reverted in 51Degrees/cloud (the seven 51Did demo copies hold the unmodified v1.1.0 asset and the new class names sit inert until the release lands).

One gap worth knowing: 51Degrees/cloud does not currently run the update-example-assets step, so its copies will not refresh automatically the way the example repositories do. That needs adding there, tracked separately.

A full size button in a table cell forces the column wide enough to
wrap its own label, which is what happens to the copy button beside
each identifier in the 51Did example. This keeps the control to the
row's height and stops the label breaking across lines.

Sits with the table it belongs to rather than as a button modifier,
because it is about the cell it sits in, and keeping it in the
examples layer means the documentation and conference builds are
untouched.
@jwrosewell

Copy link
Copy Markdown
Contributor Author

Second commit adds .c-eg-table__action, for a control sitting in a table cell.

A full size button in a cell forces the column wide enough to wrap its own label, which is what happens to the copy button beside each identifier in the 51Did example. The action keeps the control to the row's height and stops the label breaking across lines.

It sits in 06-examples/02-table.scss with the table it belongs to, rather than as a b-btn modifier in 01-base, because it is about the cell it sits in and keeping it in the examples layer leaves the documentation and conference builds untouched.

examples-main.min.css now builds to 12.4kb, still with every byte of the current v1.1.0 release unchanged.

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