Frontend School

GPU Model Explorer with Client-Side Pagination

Machine Coding
medium

GPU Model Explorer with Client-Side Pagination

Medium
React
TypeScript
Frontend
Pagination
UI
State Management

Overview

NVIDIA's product catalog contains a vast number of GPU models, making it challenging for users to browse them all at once. To improve user experience and application performance, we need to implement a robust client-side pagination system. This problem focuses on building a UI component that displays a list of GPU models, allowing users to navigate through pages efficiently.

What you need to do / Task

Your goal is to build a React component that displays a list of GPU models from a provided mock dataset, implementing client-side pagination.

  1. Display GPU Models: Render a list of GPU models, showing key details like name and architecture.
  2. Implement Client-Side Pagination:
    • Display a fixed number of GPU models per page (e.g., 5-10 items). You can choose and hardcode this value.
    • Show pagination controls including "Previous", "Next", and a series of page numbers.
    • Clicking "Previous" or "Next" should navigate to the adjacent page.
    • Clicking a specific page number should navigate directly to that page.
  3. Handle Edge Cases:
    • The "Previous" button should be disabled when on the first page.
    • The "Next" button should be disabled when on the last page.
    • The current active page number in the pagination controls should be clearly highlighted.

UI/UX expectations

  • The main content area should display the list of GPU models. Each model can be represented as a simple card or list item.
  • Pagination controls should be placed prominently below the list of GPU models.
  • The pagination controls should include "Previous", "Next", and a reasonable range of page numbers (for the given mock data, displaying all page numbers is acceptable).
  • The currently active page number should have distinct styling (e.g., bold text, different background).
  • Disabled "Previous" and "Next" buttons should visually indicate they are unclickable (e.g., greyed out, lower opacity).

Acceptance criteria

  • The application renders a list of GPU models.
  • Only the correct subset of GPU models for the current page is displayed.
  • "Previous" button navigates to the prior page and is disabled on the first page.
  • "Next" button navigates to the subsequent page and is disabled on the last page.
  • Clicking on a page number directly navigates to that page.
  • The active page number is visually highlighted in the pagination controls.
  • The number of items per page is consistent.

Constraints

Constraints & assumptions

  • Data Source: All GPU model data is provided upfront as a mock array within App.tsx. No external API calls are required.
  • Pagination Type: Client-side pagination only. All data is loaded, and your component will slice it for display.
  • Items Per Page: You can choose a fixed number of items per page (e.g., 5 or 8) and hardcode it.
  • Technology: React with TypeScript.
  • Time Budget: This problem is designed to be completable within approximately 45 minutes.
  • Styling: Basic functional styling is sufficient. Focus on layout and interactivity rather than pixel-perfect design.

Out of scope

  • Server-side pagination or API integration.
  • Advanced features like filtering, sorting, or search.
  • Complex routing for pagination (e.g., /?page=2).
  • Extensive, production-ready styling or design system integration.
  • Accessibility beyond basic button states and semantic HTML.

What interviewers evaluate

  • Correctness of Pagination Logic: Does the pagination work as specified, handling all pages and edge cases?
  • React State Management: Effective use of useState and other React hooks to manage component state and re-renders.
  • Component Structure: Clear separation of concerns, readability, and maintainability of the code.
  • TypeScript Usage: Proper type definitions for data and component props, ensuring type safety.
  • User Experience: Responsiveness of UI, clear indication of current state, and disabled button states.

Loading editor...