diff --git a/frontend/src/components/GameListItem.test.tsx b/frontend/src/components/GameListItem.test.tsx index 4244c16..098c814 100644 --- a/frontend/src/components/GameListItem.test.tsx +++ b/frontend/src/components/GameListItem.test.tsx @@ -29,9 +29,9 @@ describe("GameListItem", () => { expect(screen.getByRole("img", { name: "Great Game" })).toHaveAttribute("src", "/game.png"); }); - it("falls back to an em dash when year or tags are missing", () => { + it("falls back to N/A when year or tags are missing", () => { renderItem({ year: null, tags: "" }); - expect(screen.getAllByText("—")).toHaveLength(2); + expect(screen.getAllByText("N/A")).toHaveLength(2); }); it("links to the game's detail page", () => { diff --git a/frontend/src/components/Header.test.tsx b/frontend/src/components/Header.test.tsx index 616f198..31d4cf1 100644 --- a/frontend/src/components/Header.test.tsx +++ b/frontend/src/components/Header.test.tsx @@ -28,7 +28,7 @@ describe("Header", () => { it("renders the wordmark, search field and My Ratings link", () => { renderHeader("/project2"); - expect(screen.getByText("Working Title")).toBeInTheDocument(); + expect(screen.getByText("NTNU GameShelf")).toBeInTheDocument(); expect(screen.getByPlaceholderText("Search games...")).toHaveValue(""); expect(screen.getByText("My Ratings")).toBeInTheDocument(); expect(screen.queryByRole("button", { name: "Clear" })).not.toBeInTheDocument(); @@ -58,7 +58,7 @@ describe("Header", () => { it("links home to the current query on the grid page", () => { renderHeader("/project2?search=zelda"); - expect(screen.getByText("Working Title").closest("a")).toHaveAttribute( + expect(screen.getByText("NTNU GameShelf").closest("a")).toHaveAttribute( "href", "/project2/?search=zelda", ); @@ -67,7 +67,7 @@ describe("Header", () => { it("links home to the persisted grid query from other pages", () => { sessionStorage.setItem(GRID_QUERY_STORAGE_KEY, "search=bar"); renderHeader("/project2/my-ratings"); - expect(screen.getByText("Working Title").closest("a")).toHaveAttribute( + expect(screen.getByText("NTNU GameShelf").closest("a")).toHaveAttribute( "href", "/project2/?search=bar", ); @@ -75,6 +75,6 @@ describe("Header", () => { it("links home plainly when there is no persisted query", () => { renderHeader("/project2/my-ratings"); - expect(screen.getByText("Working Title").closest("a")).toHaveAttribute("href", "/project2"); + expect(screen.getByText("NTNU GameShelf").closest("a")).toHaveAttribute("href", "/project2"); }); }); diff --git a/frontend/src/components/Pagination.tsx b/frontend/src/components/Pagination.tsx new file mode 100644 index 0000000..a99869c --- /dev/null +++ b/frontend/src/components/Pagination.tsx @@ -0,0 +1,47 @@ +import { Button } from "react-bootstrap"; +import { ChevronLeft, ChevronRight } from "react-bootstrap-icons"; + +interface PaginationProps { + page: number; + totalPages: number; + onPrevPage: () => void; + onNextPage: () => void; +} + +export default function Pagination({ + page, + totalPages, + onPrevPage, + onNextPage, +}: PaginationProps) { + return ( +
+ + + Page {page} of {totalPages} + + +
+ ); +} diff --git a/frontend/src/components/Toolbar/Toolbar.module.css b/frontend/src/components/Toolbar/Toolbar.module.css index 901e1a4..d0f4173 100644 --- a/frontend/src/components/Toolbar/Toolbar.module.css +++ b/frontend/src/components/Toolbar/Toolbar.module.css @@ -38,21 +38,6 @@ background-color: var(--color-brand); } -.pagination { - display: inline-flex; - align-items: center; - justify-self: center; - gap: 0.75rem; -} - -.pageButton { - display: inline-flex; - align-items: center; - padding: 0; - color: inherit; - font: inherit; -} - .sort { display: inline-flex; align-items: center; diff --git a/frontend/src/components/Toolbar/Toolbar.tsx b/frontend/src/components/Toolbar/Toolbar.tsx index 4a9fe71..c482e82 100644 --- a/frontend/src/components/Toolbar/Toolbar.tsx +++ b/frontend/src/components/Toolbar/Toolbar.tsx @@ -1,14 +1,7 @@ import { useEffect, useRef, useState } from "react"; import type { ChangeEvent } from "react"; import { Button, Form } from "react-bootstrap"; -import { - ArrowDownUp, - ChevronDown, - ChevronLeft, - ChevronRight, - Funnel, - X, -} from "react-bootstrap-icons"; +import { ArrowDownUp, ChevronDown, Funnel, X } from "react-bootstrap-icons"; import { ESRB_OPTIONS, PLATFORM_OPTIONS, @@ -18,6 +11,7 @@ import { } from "../../constants/filterOptions"; import type { GameFilters, SortField, SortState } from "../../types/gameQuery"; import { EMPTY_FILTERS, hasActiveFilters } from "../../types/gameQuery"; +import Pagination from "../Pagination"; import styles from "./Toolbar.module.css"; interface ToolbarProps { @@ -101,31 +95,12 @@ export default function Toolbar({ )} -
- - - Page {page} of {totalPages} - - -
+
@@ -144,7 +119,8 @@ export default function Toolbar({