mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-03 05:09:58 -05:00
ui: act on review -- corner chrome, a swallowed className, and the poster frame
Three real defects from the PR review, each reproduced before it was fixed.
The tag mark and a video's duration were pinned to the poster BAND, which
is the full width of the card, rather than to the painted image. Once the
height cap landed the two stopped being the same box: measured, the mark
sat 39px clear of a book cover, 56px clear of a small poster and 60px
clear of a vertical video, and the duration 55px clear. It went unnoticed
because on a 16:9 poster the image fills the band and the two pin to the
same place -- so the tests cover the height-bound ratios, and assert the
letterbox gap is really there before measuring into it.
CardPoster now centres a frame that shrink-wraps the image, and the frame
is what corner chrome is positioned against. VideoCard passes its
duration through a new `overlay` prop rather than wrapping CardPoster in a
box of its own.
The mark also went back INSIDE the link. Splitting it out made the
tagged corner a dead spot on an otherwise clickable poster.
CardLink and ExternalCardLink wrote `className='...' {...props}`, so a
caller's className replaced the pair instead of adding to it. Every
archive title passes `card-title-ellipsis`, so every archive title lost
`card-link` -- the one card type this PR migrates for layout was the one
missing the title treatment. Both compose now.
On the fourth comment, the breadth of the ActionIcon remap: it is
deliberate and the numbers are small. 59 IconButton call sites, 52 of
them at the default size, 7 at `xs` (one in Flasher, three in the
inventory schema editor). The one library control that stands beside an
input rather than a button is SearchBox's clear, and the remap is exactly
what that scale is for -- it now matches its field to the pixel, where
before it was 28px against a 36px input. Guarded by a test that fails at
42 vs 36 if the default is reverted.
1078 jest, 158 in ui-layout.cy.js, clean build.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c581dadae6
commit
e36bd85f54
5 changed files with 190 additions and 17 deletions
|
|
@ -2,7 +2,8 @@ import React from 'react';
|
|||
import {act, render, screen, waitFor} from '../test-utils';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import {
|
||||
contrastingColor, contrastRatio, DirectorySearch, HelpHeader, InfoHeader, loadRole,
|
||||
CardLink, contrastingColor, contrastRatio, DirectorySearch, ExternalCardLink, HelpHeader,
|
||||
InfoHeader, loadRole,
|
||||
SearchResultsInput, TAG_TEXT_DARK, TAG_TEXT_LIGHT,
|
||||
} from './Common';
|
||||
import {healthRole} from './admin/ControllerPage';
|
||||
|
|
@ -684,3 +685,25 @@ describe('a heading keeps its help icon on the same row as the text', () => {
|
|||
expect(container.querySelector('.inline-header')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('card links', () => {
|
||||
/*
|
||||
* `.card-link` is what makes a card's title read as the card's text rather than as a
|
||||
* link, so a title that misses it is the one thing on the card in the wrong colour.
|
||||
* Both helpers set the class and then spread the caller's props over it, so any call
|
||||
* site passing a className of its own -- which is every archive title, via
|
||||
* `card-title-ellipsis` -- silently replaced the class instead of adding to it.
|
||||
*/
|
||||
it.each([
|
||||
['CardLink', <CardLink to='/archives/1' className='card-title-ellipsis'>Title</CardLink>],
|
||||
['ExternalCardLink',
|
||||
<ExternalCardLink to='http://x/a.html' className='card-title-ellipsis'>Title</ExternalCardLink>],
|
||||
])('%s keeps its own classes when the call site adds one', (_name, element) => {
|
||||
render(element);
|
||||
|
||||
const link = screen.getByText('Title');
|
||||
expect(link).toHaveClass('card-link');
|
||||
expect(link).toHaveClass('no-link-underscore');
|
||||
expect(link).toHaveClass('card-title-ellipsis');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue