import { PaginationWithPageNumbers } from 'components/Pagination' import { MAX_GAMES_PER_PAGE } from 'constants.ts' import { useGames } from 'hooks' import { useState } from 'react' import { GameCard } from '../components/GameCard' import '../styles/pagination.css' import '../styles/search.css' import '../styles/styles.css' export const GamesPage = () => { const games = useGames() const [currentPage, setCurrentPage] = useState(1) // Pagination logic const totalGames = games.length const totalPages = Math.ceil(totalGames / MAX_GAMES_PER_PAGE) const startIndex = (currentPage - 1) * MAX_GAMES_PER_PAGE const endIndex = startIndex + MAX_GAMES_PER_PAGE const currentGames = games.slice(startIndex, endIndex) const handlePageChange = (page: number) => { if (page >= 1 && page <= totalPages) { setCurrentPage(page) } } return (