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
27 changes: 11 additions & 16 deletions frontend/src/pages/shoppingLists/PreviousListsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { Link } from "react-router";
import { useEffect, useMemo, useState } from "react";
import SegmentedControl from "../../components/segmentedControl/SegmentedControl";
import PreviousListRow from "./PreviousListRow";
import type { ShoppingList } from "./shoppingListTypes";
import "./PreviousListsPage.css";
import "./ShoppingListsPage.css";
import { mockLists } from "./shoppingListMockData";

const LIST_TABS = [
{ value: "active", label: "Aktive", to: "/lists" },
{ value: "previous", label: "Tidligere", to: "/lists/history" },
];



const monthFormatter = new Intl.DateTimeFormat("nb-NO", {
Expand Down Expand Up @@ -128,22 +133,12 @@ export default function PreviousListsPage() {
</p>
</div>

<nav
<SegmentedControl
className="shopping-lists-page__tabs"
aria-label="Handlelisteoversikter"
>
<Link to="/lists" className="shopping-lists-page__tab">
Aktive
</Link>

<Link
to="/lists/history"
className="shopping-lists-page__tab shopping-lists-page__tab--active"
aria-current="page"
>
Tidligere
</Link>
</nav>
ariaLabel="Handlelisteoversikter"
value="previous"
options={LIST_TABS}
/>
</header>


Expand Down
7 changes: 2 additions & 5 deletions frontend/src/pages/shoppingLists/ShoppingListCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import type { ShoppingList } from "./shoppingListTypes";
import Badge from "../../components/badge/Badge";
import "./ShoppingListsPage.css";

interface ShoppingListCardProps {
Expand Down Expand Up @@ -46,11 +47,7 @@ export default function ShoppingListCard({
ENDRET {formattedDate}
</span>

{list.inUse && (
<span className="shopping-list-card__badge">
I BRUK
</span>
)}
{list.inUse && <Badge>I BRUK</Badge>}
</div>

<h2 className="shopping-list-card__title">
Expand Down
59 changes: 0 additions & 59 deletions frontend/src/pages/shoppingLists/ShoppingListsPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,6 @@
color: var(--text-muted);
}

.shopping-list-card__badge {
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-on-dark);
background: var(--bg-brand);
padding: 4px 7px;
border-radius: 2px;
white-space: nowrap;
}

.shopping-list-card__title {
margin: 6px 0 16px;
font-family: var(--font-note);
Expand Down Expand Up @@ -223,34 +213,6 @@
flex-wrap: wrap;
}

.shopping-lists-page__tabs {
display: flex;
align-items: center;
padding: 3px;
background: var(--bg-muted);
border: 1px solid var(--border-hairline);
border-radius: 6px;
}

.shopping-lists-page__tab {
padding: 8px 12px;
font-family: var(--font-mono);
font-size: 10px;
letter-spacing: 0.04em;
text-transform: uppercase;
}

.shopping-lists-page__tab--active {
background: var(--bg-surface);
border: 1px solid var(--border-brand);
border-radius: 4px;
color: var(--text-brand);
}

.shopping-lists-page__tab--disabled {
color: var(--text-muted);
}

/* Rutete bakgrunn */

.shopping-lists-page__board {
Expand Down Expand Up @@ -330,27 +292,6 @@
flex-shrink: 0;
}

.shopping-lists-page__tab {
display: inline-flex;
align-items: center;
justify-content: center;
text-decoration: none;
color: var(--text-muted);
}

.shopping-lists-page__tab--active {
color: var(--text-brand);
}

.shopping-lists-page__tab:hover {
color: var(--text-accent);
}

.shopping-lists-page__tab:focus-visible {
outline: 2px solid var(--text-accent);
outline-offset: 3px;
}

/* Sortering av aktive handlelister */
.shopping-lists-page__sort {
display: flex;
Expand Down
31 changes: 12 additions & 19 deletions frontend/src/pages/shoppingLists/ShoppingListsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useState } from "react";
import { Link, useNavigate } from "react-router";
import { useNavigate } from "react-router";
import SegmentedControl from "../../components/segmentedControl/SegmentedControl";
import ShoppingListCard from "./ShoppingListCard";
import { mockLists } from "./shoppingListMockData";
import "./ShoppingListsPage.css";
Expand All @@ -8,6 +9,11 @@ type SortOrder = "newest" | "oldest" | "name-asc" | "name-desc";

const SORT_STORAGE_KEY = "active-lists-sort-order";

const LIST_TABS = [
{ value: "active", label: "Aktive", to: "/lists" },
{ value: "previous", label: "Tidligere", to: "/lists/history" },
];

function loadSortOrder(): SortOrder {
try {
const saved = localStorage.getItem(SORT_STORAGE_KEY);
Expand Down Expand Up @@ -100,25 +106,12 @@ export default function ShoppingListsPage() {
</select>
</label>

<nav
<SegmentedControl
className="shopping-lists-page__tabs"
aria-label="Handlelisteoversikter"
>
<Link
to="/lists"
className="shopping-lists-page__tab shopping-lists-page__tab--active"
aria-current="page"
>
Aktive
</Link>

<Link
to="/lists/history"
className="shopping-lists-page__tab"
>
Tidligere
</Link>
</nav>
ariaLabel="Handlelisteoversikter"
value="active"
options={LIST_TABS}
/>

<button
type="button"
Expand Down