mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-21 15:36:18 -05:00
ui: bring back the card mimetype accent
Two agents independently dropped it, each because our Card had no `color` prop and each citing the other's precedent -- which is how a deliberate feature quietly becomes a convention. Roland wanted it back. Card takes a token colour name and draws it as a 3px edge along the top rather than tinting the surface: surfaces stay flat per the design rules, and an edge survives night mode without becoming a bright patch. Because it is a token, the accent remaps per theme -- four hues in light and dark, a single one in night and amber, which is the point of those themes. Restored on every card that shows a file: the video, image and generic file cards in Files.js, and the archive card. All of them take it from `mimetypeColor(mimetype, path)`, the same helper that colours the file icons, so a card and its icon agree.
This commit is contained in:
parent
96d84dfab8
commit
a1fbda7363
5 changed files with 51 additions and 11 deletions
|
|
@ -11,6 +11,7 @@ import {themeChoices} from '../../themes/names';
|
|||
import {
|
||||
ActionInput,
|
||||
Button,
|
||||
Card,
|
||||
Confirm,
|
||||
Header,
|
||||
Icon,
|
||||
|
|
@ -432,6 +433,23 @@ describe('Table', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('Card', () => {
|
||||
it('draws a mimetype accent from a token, not a hex', () => {
|
||||
// File cards carry the mimetype's colour on their top edge so a grid of results is
|
||||
// scannable by kind. Semantic did this with `<Card color='violet'>`; two migrated
|
||||
// files had dropped the accent because our Card had no equivalent.
|
||||
const {container} = renderUI(<Card title='Water Storage.pdf' color='red'/>);
|
||||
|
||||
expect(container.firstChild).toHaveStyle({borderTop: '3px solid var(--red)'});
|
||||
});
|
||||
|
||||
it('has no accent when no colour is given', () => {
|
||||
const {container} = renderUI(<Card title='Plain'/>);
|
||||
|
||||
expect(container.firstChild.style.borderTop).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Panel', () => {
|
||||
it('marks danger zones', () => {
|
||||
const {container} = renderUI(<Panel danger>Destructive actions</Panel>);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue