Welcome to the React Product Card Assessment! This project tests your ability to work with React components, state management, and data handling using React + Vite.
The fastest way to get started - everything is pre-configured!
- Click the Codespaces badge above
- Wait for environment to initialize (~2-3 minutes)
- Run
npm run test:e2e:headedto see requirements - Start implementing! π―
See Codespace Setup Guide for detailed instructions.
If you prefer to work locally:
Prerequisites:
- Node.js (version 18 or higher)
- npm, yarn, or pnpm package manager
Setup Instructions:
-
Clone the repository:
git clone <repository-url> cd card-assessment
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:3000to view the application.
You will be implementing a product catalog with shopping cart functionality. The project includes pre-built components that need to be connected together with proper state management.
- ProductCard: Displays individual product information with an "Add to Order" button
- OrderStatusButton: Shows the count of products in the cart (top-right corner)
- OrderModal: Displays the list of products added to the cart
- App: Main application component
src/assets/products.json: Contains 8 sample products with title, SKU, description, and image URL
Complete the following tasks in order:
- Implement cart state management using React hooks (useState, useContext, or useReducer)
- Wire up the ProductCard component so clicking "Add to Order" adds/removes the product from the cart
- Show visual feedback on the ProductCard when a product is in the cart (different button style and text)
- Connect the OrderStatusButton to display the actual number of products in the cart
- The counter should update in real-time as products are added/removed
- Wire up the OrderStatusButton click event to open the OrderModal
- Populate the OrderModal with the current cart contents
- Implement modal close functionality
- Load products from
src/assets/products.json - Replace the single sample product with a 4-column responsive grid of all products
- Ensure all cart functionality works correctly with multiple products
- Ensure responsive design works on different screen sizes
- Add appropriate loading states if needed
- Implement smooth user interactions and transitions
- Handle edge cases (empty cart, etc.)
- Use React functional components with hooks
- Maintain clean, readable code with proper component structure
- Use Bootstrap classes (already included) for styling
- No additional libraries required (but you may add them if justified)
- Follow React best practices for state management and component design
Your submission will be evaluated on:
- Functionality: All requirements working as specified
- Code Quality: Clean, maintainable, and well-organized code
- React Best Practices: Proper use of hooks, component structure, and state management
- User Experience: Intuitive and responsive interface
- Problem Solving: How you handle edge cases and unexpected scenarios
This project is configured with:
- VS Code Extensions: ESLint, Prettier, Live Server, and React-specific tools
- Auto-formatting: Code will format automatically on save
- Port forwarding: The development server (port 3000) is automatically accessible
- Dependencies: All packages install automatically in Codespaces
- E2E Testing: Playwright tests to validate your implementation
This assessment includes comprehensive e2e tests to help validate your implementation:
# Install browser dependencies (first time only)
npm run test:e2e:install
# Run all tests
npm run test:e2e
# Run tests with visible browser (helpful for debugging)
npm run test:e2e:headed
# Interactive test UI
npm run test:e2e:uiThe tests are organized to match the assessment requirements:
- Core Tests: Map directly to the 4 main requirements and point values
- Comprehensive Tests: Edge cases, responsive design, and user experience
- Multiple Browsers: Chrome, Firefox, Safari, and mobile viewports
- Start Early: Run tests to see what needs to be implemented
- Incremental: Test each feature as you build it
- Debug Mode: Use
npm run test:e2e:debugwhen tests fail - Validation: All tests should pass when assessment is complete
π See E2E_TESTING_GUIDE.md for detailed testing instructions
This project includes comprehensive end-to-end tests to help you validate your implementation:
# Install browsers (first time only)
npm run test:e2e:install
# Run tests
npm run test:e2e
# Debug mode
npm run test:e2e:debugThe tests cover all assessment requirements:
- β Product cart state management (25 points)
- β Cart counter integration (15 points)
- β Order modal implementation (20 points)
- β Product grid implementation (25 points)
- β User experience & polish (15 points)
All tests should pass when your assessment is complete.
For detailed testing instructions, see E2E_TESTING_GUIDE.md.
-
Commit your changes:
git add . git commit -m "Complete React assessment" git push
-
Ensure your code:
- Runs without errors using
npm run dev - Passes linting with
npm run lint - Includes all required functionality
- Has been tested with different scenarios
- Runs without errors using
-
Share your work:
- Provide the GitHub repository URL with your completed code
- Or share the Codespace if instructed by your coordinator
- Follow the same git workflow as above
- Ensure all changes are pushed to your repository
- Test that the application works correctly
This assessment is designed to take approximately 2-3 hours to complete thoroughly.
Codespace Issues:
- If the Codespace doesn't start, try refreshing the page
- If dependencies aren't installed, run
npm installmanually - If the port isn't forwarded, check the "Ports" panel in VS Code
Development Issues:
- Make sure the development server is running (
npm run dev) - Check the browser console for any JavaScript errors
- Use the VS Code integrated terminal for running commands
If you encounter any setup issues or have questions about the requirements, please reach out to your assessment coordinator.
Good luck!