- Fork the repo (Make a copy of it to your repos)
- Clone your project on your machine
- Install dependencies and run it locally
- Node.js (v16 or higher)
- npm or yarn
bash# Clone the repository
git clone https://github.com/YOUR_USERNAME/memory-card-react.git
# Navigate to project directory
cd memory-card-react
# Install dependencies
npm install
# Start development server
npm run dev
memory-card-react/
├── public/
│ ├── assets/
│ │ └── images/ # Hero card images
│ │ ├── capitain.jpg
│ │ ├── deadpool.jpg
│ │ ├── ironman.jpg
│ │ ├── spider.jpg
│ │ ├── superman.jpg
│ │ └── wolverine.jpg
│ └── vite.svg
├── src/
│ ├── components/
│ │ ├── CardComp.tsx # Individual card component
│ │ └── CardComp.module.css
│ ├── data/
│ │ └── cards.json # Card data configuration
│ ├── styles/
│ │ └── bounceIn.css # Animation styles
│ ├── types/
│ │ └── card.type.ts # TypeScript type definitions
│ ├── App.tsx # Main game logic and state management
│ ├── main.tsx # Application entry point
│ ├── index.css # Global styles
│ └── vite-env.d.ts # Vite type declarations
├── .gitignore
├── eslint.config.js
├── index.html
├── package.json
├── README.md
├── tsconfig.app.json
├── tsconfig.json
├── tsconfig.node.json
└── vite.config.ts
- CardComp: Individual card component handling flip animations and click events
- App: Main game component managing game state, logic, and card interactions
- cards.json → Contains base hero data (6 unique heroes)
- App.tsx → Creates pairs, shuffles cards, manages game state
- CardComp → Receives card data and click handlers as props
- Types → TypeScript definitions ensure type safety
- State Management: React useState for game state, flipped cards, and moves
- Card Matching Logic: Compares hero names when two cards are flipped
- Animation: CSS modules with flip animations and hover effects
- TypeScript: Full type safety with custom type definitions
- CSS Modules: Scoped component styles to prevent conflicts
- CSS Custom Properties: Consistent theming with CSS variables
- Animations: Smooth card flip transitions and bounce effects
- Responsive Design: Grid layout that adapts to different screen sizes
- React 18 - UI library
- TypeScript - Type safety and better developer experience
- Vite - Fast build tool and development server
- CSS Modules - Scoped component styling
- ESLint - Code linting and formatting
- Superhero images used for educational purposes Printerest
- Inspired by classic memory card games
- Built as a learning project for React and TypeScript