frontend: add WarnBanner Preact component, compose ApiErrorPanel from it
mara, on review: "i want each component to import its own css file itself[;] if you need a bunch of extra css externally, its not a proper component ... you may need to migrate other components that you would want to use first". WarnBanner is the Preact-component successor to the shadow-DOM <hive-warn> custom element (same three-tier info/warning/error visual language, colours copied faithfully from hive-warn.css). ApiErrorPanel now composes it instead of owning a copy of the border/colour/pulse rules itself — its own CSS is back down to just the layout that's actually specific to it (heading, copy button, detail text). Re-verified with a fresh mock-server screenshot: same rendered output as before, now via composition instead of a duplicated banner shape.
This commit is contained in:
parent
f60aab4717
commit
ca84079a21
1 changed files with 94 additions and 35 deletions
|
|
@ -1,27 +1,12 @@
|
|||
/* api-error-panel.css — `<ApiErrorPanel>`'s own styling, colour + layout
|
||||
both. Not slotted into `<hive-warn>` (see the component's own header
|
||||
for why) — the border/background/pulse below are deliberately copied
|
||||
from `hive-warn.css`'s `level="error"` rule rather than invented fresh,
|
||||
so this still reads as "the same error banner" everywhere it appears,
|
||||
just declared locally instead of shared through a shadow root. Reuses
|
||||
theme.css's own documented semantics (`--red` = "errors, fail state"),
|
||||
same as `hive-warn.css` does. */
|
||||
/* api-error-panel.css — layout for `<ApiErrorPanel>`'s content, plus the
|
||||
one spacing concern that's genuinely this component's own (the top
|
||||
margin — `WarnBanner` only sets `margin-bottom`, tuned for a banner
|
||||
that's the first thing in a page, not a panel that usually follows a
|
||||
form or a table). Colour/border/pulse belong to `WarnBanner`
|
||||
(../warn-banner/WarnBanner.css) — not duplicated here. */
|
||||
|
||||
.api-error-panel {
|
||||
display: block;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 0.6em;
|
||||
border: 1px solid var(--red);
|
||||
border-radius: 4px;
|
||||
padding: 0.5em 0.8em;
|
||||
color: var(--red);
|
||||
background: color-mix(in srgb, var(--red) 8%, transparent);
|
||||
text-shadow: 0 0 6px color-mix(in srgb, currentColor 40%, transparent);
|
||||
animation: api-error-panel-pulse 2.4s ease-in-out infinite;
|
||||
}
|
||||
@keyframes api-error-panel-pulse {
|
||||
0%, 100% { box-shadow: 0 0 12px -4px color-mix(in srgb, currentColor 55%, transparent); }
|
||||
50% { box-shadow: 0 0 22px -2px color-mix(in srgb, currentColor 95%, transparent); }
|
||||
}
|
||||
.api-error-heading {
|
||||
display: flex;
|
||||
|
|
|
|||
Loading…
Reference in a new issue