mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-20 15:06:19 -05:00
ui: test the last four components, and put the last four in the gallery
Closes the tail of the library: `Loader`, `Loading`, `Placeholder` and `Checkbox` had no test of their own, and `IconStack`, `MediaFilterToggle`, `MultiSelect` and `NumberInput` were not in the gallery, which the project rule says every component must be. Putting them in the gallery is what found the rest of this. An IconStack's corner glyph paints a disc of the surface behind itself so the two sets of strokes do not cross, and that surface was hardcoded to the page background. It is right in exactly one of the three places a stack appears. The nav bar showed a white disc on the red bar, and the file browser's "New Folder" button showed one punched through the blue fill. It is now `--icon-stack-bg`, defaulting to the page: the file browser passes the button's fill, and the nav bar sets it on the <nav> beside the colour it already writes there, so it inherits -- the bar's colour is a user setting and cannot be named by a token. A MultiSelect's chosen options are Mantine Pills, and Pill is the one component that ignores the radius theme: it writes `--pill-radius: rem(1000)` onto the element, which zeroing `--mantine-radius-xl` cannot reach. They were lozenges on a page of square boxes. Twelve jest tests and sixteen browser tests. The browser half covers what jsdom cannot judge: that a Skeleton is a different colour from the panel it covers in all four themes (its greys are remapped to our tokens, and neither `--border` nor `--bg` was picked with a panel behind it), that the loader colour resolves through the token, and that the corner disc matches its surface. Every one was checked red against a planted regression first. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3315510708
commit
2c812b5410
7 changed files with 392 additions and 13 deletions
|
|
@ -363,7 +363,14 @@ export function NavBar() {
|
|||
return <>
|
||||
<Media between={['mobile', 'tablet']}>
|
||||
<nav className='wrolpi-navbar' id='global_navbar'
|
||||
style={{background: `var(--${navColor})`, color: 'var(--btn-text)'}}>
|
||||
style={{
|
||||
background: `var(--${navColor})`,
|
||||
color: 'var(--btn-text)',
|
||||
// The hotspot glyph stacks two icons, and the corner one paints a disc
|
||||
// of its surface behind itself. The bar's colour is the user's choice,
|
||||
// so it has to be handed down rather than looked up from a token.
|
||||
'--icon-stack-bg': `var(--${navColor})`,
|
||||
}}>
|
||||
{homeLink}
|
||||
<div className='wrolpi-navbar-right'>
|
||||
{icons}
|
||||
|
|
@ -394,7 +401,14 @@ function DesktopNav({navColor, homeLink, icons}) {
|
|||
return (
|
||||
<div ref={containerRef}>
|
||||
<nav className='wrolpi-navbar' id='global_navbar'
|
||||
style={{background: `var(--${navColor})`, color: 'var(--btn-text)'}}>
|
||||
style={{
|
||||
background: `var(--${navColor})`,
|
||||
color: 'var(--btn-text)',
|
||||
// The hotspot glyph stacks two icons, and the corner one paints a disc
|
||||
// of its surface behind itself. The bar's colour is the user's choice,
|
||||
// so it has to be handed down rather than looked up from a token.
|
||||
'--icon-stack-bg': `var(--${navColor})`,
|
||||
}}>
|
||||
<span ref={homeRef} style={{display: 'contents'}}>{homeLink}</span>
|
||||
{(isReady ? visibleLinks : allLinks).map((link, idx) => (
|
||||
<span
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue