Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,22 @@
font-size: 13px;
color: var(--text);
}

/* Ikonknappene: 24x24 er minste anbefalte klikkflate (WCAG 2.5.8) */
.results-bar__views {
align-items: center;
}
.results-bar__views button {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
border-bottom: 1px solid transparent;
}
/* Understreking virker ikke på SVG, så aktiv visning markeres med en 1px strek under knappen,
samme tykkelse som linjen under sorteringsmenyen. Ikke bare farge, så det er tydelig
også for fargeblinde. */
.results-bar__views button[aria-pressed='true'] {
border-bottom-color: var(--text-h);
}
67 changes: 34 additions & 33 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { MyFavorites } from './pages/Profile/MyFavorites';
import { ProfileOverview } from './pages/Profile/ProfileOverview';
import { useAuth } from './hooks/useAuth';
import { useFavorites } from './hooks/useFavorites';
import { GridIcon, ListIcon, ShowcaseIcon } from './components/ViewIcons/ViewIcons';

//dette er antall spill per side
const PAGE_SIZE = 20;
Expand Down Expand Up @@ -223,39 +224,39 @@ function App() {
<div className="results-bar__controls">
<SortSelect value={sort} onChange={handleSortChange} />

<div role="group" aria-label="Visning" className="results-bar__views">
<span aria-hidden="true">visning</span>
<button
type="button"
className="text-button"
aria-pressed={view === 'list'}
aria-label="Visning 1: liste"
title="Liste"
onClick={() => setView('list')}
>
1
</button>
<button
type="button"
className="text-button"
aria-pressed={view === 'grid'}
aria-label="Visning 2: rutenett"
title="Rutenett"
onClick={() => setView('grid')}
>
2
</button>
<button
type="button"
className="text-button"
aria-pressed={view === 'showcase'}
aria-label="Visning 3: utstilling"
title="Utstilling"
onClick={() => setView('showcase')}
>
3
</button>
</div>
<div role="group" aria-label="Visning" className="results-bar__views">
<span aria-hidden="true">visning</span>
<button
type="button"
className="text-button"
aria-pressed={view === 'list'}
aria-label="Liste"
title="Liste"
onClick={() => setView('list')}
>
<ListIcon />
</button>
<button
type="button"
className="text-button"
aria-pressed={view === 'grid'}
aria-label="Rutenett"
title="Rutenett"
onClick={() => setView('grid')}
>
<GridIcon />
</button>
<button
type="button"
className="text-button"
aria-pressed={view === 'showcase'}
aria-label="Utstilling"
title="Utstilling"
onClick={() => setView('showcase')}
>
<ShowcaseIcon />
</button>
</div>
</div>
</div>

Expand Down
46 changes: 46 additions & 0 deletions frontend/src/components/ViewIcons/ViewIcons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Ikoner for visningsvelgeren. Hvert ikon er en forenklet tegning av layouten det velger.
// Inline-SVG i stedet for unicode/ikonbibliotek: lik størrelse på alle plattformer
// og ingen ekstra avhengighet. currentColor = arver tekstfargen (tema + aktiv-tilstand).
// Tynn strek (1.5) så ikonene matcher den lette teksten og 1px-linjene i resten av designet.
const svgProps = {
width: 18,
height: 18,
viewBox: '0 0 24 24',
fill: 'none',
stroke: 'currentColor',
strokeWidth: 1.5,
strokeLinecap: 'round',
strokeLinejoin: 'round',
'aria-hidden': true,
focusable: false,
} as const;

/** Liste: tre tynne linjer (mange små rader) */
export function ListIcon() {
return (
<svg {...svgProps}>
<path d="M4 6h16M4 12h16M4 18h16" />
</svg>
);
}

/** Rutenett: fire like ruter med tydelig mellomrom */
export function GridIcon() {
return (
<svg {...svgProps}>
<rect x="4" y="4" width="6" height="6" />
<rect x="14" y="4" width="6" height="6" />
<rect x="4" y="14" width="6" height="6" />
<rect x="14" y="14" width="6" height="6" />
</svg>
);
}

/** Utstilling: to feite linjer (få, store rader) */
export function ShowcaseIcon() {
return (
<svg {...svgProps}>
<path d="M5 8h14M5 16h14" strokeWidth={4} />
</svg>
);
}
Loading