typescript on both client and server with communication via socket.io
This commit is contained in:
28
components/Card.tsx
Normal file
28
components/Card.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
'use client';
|
||||
|
||||
type CardProps = {
|
||||
id: string;
|
||||
flipped: boolean;
|
||||
onFlip: (id: string) => void;
|
||||
};
|
||||
|
||||
export default function Card({ id, flipped, onFlip }: CardProps) {
|
||||
return (
|
||||
<div
|
||||
className={`w-24 h-32 flex items-center justify-center cursor-pointer`}
|
||||
onClick={() => onFlip(id)}
|
||||
>
|
||||
{flipped ? (
|
||||
<img
|
||||
src={`/cards/${id}.svg`}
|
||||
/>
|
||||
) : (
|
||||
<img
|
||||
src="/cards/1B.svg"
|
||||
/>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user