mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-21 15:36:18 -05:00
ui: nine leaf files off Semantic, and the components they needed
Phase 2, part 2. Baseline 72 -> 63.
Migrated: Tables, SortableTable, DonatePage, Share, Headline, ErrorBoundary,
and the QR code, VIN decoder, and temperature calculators.
New in the library, all in the gallery and tested:
SearchBox Semantic's `<Search category>`, keeping its grouped `results`
shape because four call sites already build it. A real
combobox: arrows move, Enter takes the highlighted suggestion
or submits the raw text, Escape closes without clearing.
Pagination Semantic's prop names, but onPageChange gets the page number
rather than an (event, data) pair.
TabBar the strip and its house style only; routing stays at the call
site, which is what decides what is active.
IconStack two glyphs composed into one symbol, named once for assistive
technology (Semantic's IconGroup).
Table.HeaderCell gains `sorted` and `onSort`.
That last one is a fix, not just a port. Semantic's `sorted` prop set
`aria-sort`; migrating a table by hand dropped it, leaving a clickable <th>
that no keyboard could reach and no screen reader could describe. Putting it
in the library means the next table gets it right without anyone remembering.
Night mode holes closed along the way: the QR codes on the donate, share, and
calculator pages are white by necessity — a scanner needs the contrast — and
they render as SVG, which the media filter does not target. In night mode that
was a lit panel. They now carry `.media`, so the filter remaps the block as a
unit and the contrast survives the mapping.
Also: `paypal` joins the icon map rather than being imported ad hoc in a page,
and FileBrowser stops passing Semantic-only table props into a DOM element.
This commit is contained in:
parent
efe84d17f1
commit
18dc90b4c2
19 changed files with 1030 additions and 224 deletions
|
|
@ -14,12 +14,16 @@ import {
|
|||
Loading,
|
||||
Message,
|
||||
Modal,
|
||||
Pagination,
|
||||
Panel,
|
||||
Placeholder,
|
||||
Progress,
|
||||
SearchBox,
|
||||
Select,
|
||||
Statistic,
|
||||
StatisticGroup,
|
||||
TabBar,
|
||||
tabClassName,
|
||||
Status,
|
||||
Table,
|
||||
TextInput,
|
||||
|
|
@ -63,6 +67,9 @@ export function ThemeSamplePage() {
|
|||
const [dismissed, setDismissed] = useState(false);
|
||||
const [modalOpen, setModalOpen] = useState(false);
|
||||
const [realColors, setRealColors] = useState(false);
|
||||
const [search, setSearch] = useState('');
|
||||
const [activeTab, setActiveTab] = useState('Videos');
|
||||
const [page, setPage] = useState(3);
|
||||
|
||||
return <div style={{maxWidth: 1060, margin: '0 auto', padding: '20px 16px 60px', color: 'var(--text)'}}>
|
||||
<h1 style={{fontSize: 21, fontWeight: 600, margin: '8px 0 4px'}}>Component gallery</h1>
|
||||
|
|
@ -211,8 +218,8 @@ export function ThemeSamplePage() {
|
|||
<Table>
|
||||
<Table.Header>
|
||||
<Table.Row>
|
||||
<Table.HeaderCell>URL</Table.HeaderCell>
|
||||
<Table.HeaderCell>Downloader</Table.HeaderCell>
|
||||
<Table.HeaderCell sorted='ascending' onSort={() => {}}>URL</Table.HeaderCell>
|
||||
<Table.HeaderCell onSort={() => {}}>Downloader</Table.HeaderCell>
|
||||
<Table.HeaderCell style={{width: 150}}>Progress</Table.HeaderCell>
|
||||
<Table.HeaderCell>Status</Table.HeaderCell>
|
||||
<Table.HeaderCell>Size</Table.HeaderCell>
|
||||
|
|
@ -293,6 +300,56 @@ export function ThemeSamplePage() {
|
|||
</Panel>
|
||||
</Section>
|
||||
|
||||
<Section label='Search'>
|
||||
<Panel>
|
||||
<SearchBox
|
||||
value={search}
|
||||
onChange={setSearch}
|
||||
onSubmit={value => toast({type: 'info', title: 'Searched', description: value})}
|
||||
onResultSelect={result => setSearch(result.title)}
|
||||
results={{
|
||||
directories: {
|
||||
name: 'Directories',
|
||||
results: [{title: 'videos/'}, {title: 'archive/'}],
|
||||
},
|
||||
channels: {
|
||||
name: 'Channels',
|
||||
results: [
|
||||
{title: 'videos/Wranglerstar', description: 'Wranglerstar'},
|
||||
{title: 'videos/RoseRed Homestead', description: 'RoseRed Homestead'},
|
||||
],
|
||||
},
|
||||
}}
|
||||
clearable
|
||||
placeholder='Search directory names…'
|
||||
/>
|
||||
<p style={{fontSize: 12, color: 'var(--muted)', marginBottom: 0, marginTop: 12}}>
|
||||
Focus the field to see grouped suggestions. Arrow keys move, Enter takes the
|
||||
highlighted one or submits what you typed, Escape closes the list without
|
||||
clearing the text.
|
||||
</p>
|
||||
</Panel>
|
||||
</Section>
|
||||
|
||||
<Section label='Pagination and tabs'>
|
||||
<Panel>
|
||||
<TabBar right={<Label color='blue'>1,432 videos</Label>}>
|
||||
{['Videos', 'Channels', 'Playlists'].map(tab => <button
|
||||
key={tab}
|
||||
type='button'
|
||||
className={tabClassName(tab === activeTab)}
|
||||
onClick={() => setActiveTab(tab)}
|
||||
>{tab}</button>)}
|
||||
</TabBar>
|
||||
<Pagination activePage={page} totalPages={12} onPageChange={setPage} showFirstAndLast/>
|
||||
<p style={{fontSize: 12, color: 'var(--muted)', marginBottom: 0, marginTop: 12}}>
|
||||
Night and amber mark the current page with a heavier border rather than a
|
||||
filled block, which would be a bright surface. The tab bar takes rendered
|
||||
children, so routing stays with the caller.
|
||||
</p>
|
||||
</Panel>
|
||||
</Section>
|
||||
|
||||
<Section label='Labels'>
|
||||
<Panel>
|
||||
<Row>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue