mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-20 23:16:17 -05:00
ui: three button-layout defects, each with a different cause
Reported together as "button groups", but they turned out to be three unrelated
things.
The file browser's footer buttons touched while the Channel Edit page's had
gaps. Channel Edit lays its buttons out with Mantine's `Group`, which is a flex
row with a gap; the footer is hand-rolled and was a plain block, so its
inline-block buttons sat flush -- JSX drops whitespace-only lines, so there was
not even a space character between them. The footer is now the flex row every
other button group already is, wrapping because it carries eight controls.
The Settings config table's Import and Save buttons had off-centre icons while
Restore in the same row looked right. Restore is an IconButton -- an ActionIcon,
which centres a lone glyph by construction. Import and Save are icon-only
Buttons, and an icon on a Button goes into Mantine's `leftSection`, which carries
a `margin-inline-end` to hold it off the label. With no label that margin is
pure offset: measured at 8px left of centre. An icon with no label is now
rendered as the button's content instead, so it centres. `Children.toArray`
decides that, because it drops nulls and the file browser passes
`{label('Delete')}` -- null whenever the bar is too narrow for words, which is
exactly where the offset showed most.
The search field's clear button sat inside the field rather than attached to it:
the control is a bordered box with `padding: 0 8px`, leaving the button 9px short
of the edge and 2px short of the height. Semantic welded it to the field --
measured on the QA Pi at zero gap and full height -- so it now stretches and
negative margins cancel the padding and the flex gap. Negative margins rather
than dropping the control's padding, because that padding is what holds the
search icon and the text off the border; only this one child should escape it.
The `html` prefix on that rule is load-bearing: Mantine sets ActionIcon's height
from `--ai-size` on its own single class, and at equal specificity the winner is
whichever stylesheet loaded last.
Fourteen new cases. One correction worth recording: the height assertion first
compared against the control's border box and failed on correct behaviour -- the
button fills the CONTENT box, and the 1px above and below it is the field's own
border, which it should sit inside rather than paint over. Each fix planted
separately; the icon change reddens three, the footer one, the clear button one.
Every case is paired with an inverse -- a labelled button must keep its icon on
the left, and the field must still be padded around its other children.
1128 jest / 63 suites, 226 in ui-layout.cy.js, clean npm run build. Confirmed
live: footer gaps 8px on one row, config glyphs at 0.0px from centre, clear
button 1px from the field edge at the field's full inner height.
This commit is contained in:
parent
5778808b8e
commit
feaca59ce5
4 changed files with 262 additions and 4 deletions
|
|
@ -348,6 +348,32 @@ html[data-theme="amber"] .wrolpi-searchbox-control:focus-within {
|
|||
flex: none;
|
||||
}
|
||||
|
||||
/*
|
||||
* The clear button is attached to the field, not floating inside it.
|
||||
*
|
||||
* The control is a bordered box with `padding: 0 8px`, so the button sat 9px short of the
|
||||
* right edge and 2px short of the full height -- reading as a glyph dropped inside the input
|
||||
* rather than as a control of its own. Semantic rendered this as an action button welded to
|
||||
* the field: measured on the QA Pi, zero gap to the input, zero to the outer edge, and the
|
||||
* full 44px height.
|
||||
*
|
||||
* Negative margins rather than removing the control's padding: the padding is what holds the
|
||||
* search icon and the text off the border, and only this one child should escape it. The
|
||||
* left margin cancels the flex gap as well, so the divider lands against the text the way
|
||||
* the attached button did.
|
||||
*
|
||||
* `html` because Mantine sets ActionIcon's height from `--ai-size` on its own single class;
|
||||
* at equal specificity the winner is whichever stylesheet loaded last, which is not a thing
|
||||
* to rely on.
|
||||
*/
|
||||
html .wrolpi-searchbox-clear {
|
||||
align-self: stretch;
|
||||
height: auto;
|
||||
margin-left: -8px;
|
||||
margin-right: -8px;
|
||||
border-left: 1px solid var(--border);
|
||||
}
|
||||
|
||||
/*
|
||||
* The suggestion list overlays the page rather than pushing it down — a search
|
||||
* that reflows the results underneath it is unusable while typing.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue