Hamkytech commited on
Commit
980371d
·
verified ·
1 Parent(s): 22c6ebc

Upload components/Card.jsx with huggingface_hub

Browse files
Files changed (1) hide show
  1. components/Card.jsx +33 -0
components/Card.jsx ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react';
2
+
3
+ const Card = ({ card, onClick, isFlipped, isMatched }) => {
4
+ return (
5
+ <div
6
+ className={`relative w-24 h-24 md:w-32 md:h-32 cursor-pointer transform transition-all duration-300 ${
7
+ isFlipped || isMatched ? 'rotate-y-180' : ''
8
+ }`}
9
+ onClick={onClick}
10
+ >
11
+ <div
12
+ className={`absolute inset-0 w-full h-full transition-all duration-300 ${
13
+ isFlipped || isMatched ? 'opacity-100' : 'opacity-0'
14
+ }`}
15
+ style={{ transform: 'rotateY(180deg)' }}
16
+ >
17
+ <div className="w-full h-full flex items-center justify-center bg-white rounded-lg shadow-lg border-2 border-gray-200">
18
+ <span className="text-4xl md:text-5xl">{card.emoji}</span>
19
+ </div>
20
+ </div>
21
+ <div
22
+ className={`absolute inset-0 w-full h-full flex items-center justify-center bg-gradient-to-br from-blue-500 to-purple-600 rounded-lg shadow-lg border-2 border-gray-300 ${
23
+ isFlipped || isMatched ? 'opacity-0' : 'opacity-100'
24
+ }`}
25
+ style={{ transform: 'rotateY(0deg)' }}
26
+ >
27
+ <span className="text-white text-4xl md:text-5xl">?</span>
28
+ </div>
29
+ </div>
30
+ );
31
+ };
32
+
33
+ export default Card;