Skip to content

Commit 3bf38e9

Browse files
committed
Improved match cards UI and added grid
1 parent a50e3cf commit 3bf38e9

File tree

2 files changed

+38
-28
lines changed

2 files changed

+38
-28
lines changed

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function App() {
4646

4747
{/* Tab Content */}
4848
{activeTab === 'matches' && (
49-
<div className="grid gap-6">
49+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
5050
{matches.length > 0 ? (
5151
matches.map(match => (
5252
<MatchCard key={match.id} match={match} onEdit={editMatch} onDelete={deleteMatch} />

src/components/MatchCard.tsx

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,60 +29,70 @@ export function MatchCard({ match, onEdit, onDelete }: MatchCardProps) {
2929
};
3030

3131
return (
32-
<div className="bg-white rounded-lg shadow-md p-4">
33-
<div className="flex items-center justify-between mb-4">
34-
<div className="flex items-center gap-2 text-gray-600">
35-
<Calendar className="w-4 h-4" />
36-
<span>{format(new Date(match.date), 'PPP', { locale: es })}</span>
32+
<div className="bg-white rounded-lg shadow-md p-5 hover:shadow-lg transition-shadow">
33+
{/* Header */}
34+
<div className="flex items-center justify-between mb-5">
35+
<div className="flex items-center gap-3 text-gray-500">
36+
<Calendar className="w-5 h-5" />
37+
<span className="text-sm font-medium">{format(new Date(match.date), 'PPP', { locale: es })}</span>
3738
</div>
38-
<div className="flex items-center gap-2">
39+
<div className="flex items-center gap-3">
3940
<button
4041
onClick={() => setIsEditing(true)}
41-
className="p-2 text-emerald-600 hover:bg-emerald-50 rounded-full transition-colors"
42+
className='rounded-full text-emerald-600 hover:text-emerald-200 transition-colors'
4243
title="Editar partido"
44+
aria-label="Editar partido"
4345
>
4446
<Edit className="w-5 h-5" />
4547
</button>
4648
<button
4749
onClick={handleDelete}
48-
className="text-red-500 hover:text-red-700 transition-colors"
50+
className='rounded-full text-red-600 hover:text-red-200 transition-colors'
51+
title="Eliminar partido"
52+
aria-label="Eliminar partido"
4953
>
5054
<Trash2 className="w-5 h-5" />
5155
</button>
5256
</div>
5357
</div>
54-
55-
<div className="grid grid-cols-3 gap-4 align-top">
58+
59+
{/* Match Details */}
60+
<div className="grid grid-cols-3 gap-6 align-top">
61+
{/* Team A */}
5662
<div className="text-center">
57-
<div className="font-semibold mb-2">Equipo A</div>
58-
<div className="text-2xl font-bold text-emerald-600">{match.teamA.score}</div>
59-
<div className="mt-2 text-sm text-gray-600">
63+
<div className="text-gray-700 font-semibold mb-2">Equipo A</div>
64+
<div className="text-3xl font-bold text-emerald-600">{match.teamA.score}</div>
65+
<div className="mt-2 text-sm text-gray-500">
6066
{match.teamA.players.map(p => p.name).join(', ')}
6167
</div>
6268
</div>
63-
64-
<div className="text-center text-gray-400">vs</div>
65-
69+
70+
<div className="text-center text-gray-400 text-xl font-bold">vs</div>
71+
72+
{/* Team B */}
6673
<div className="text-center">
67-
<div className="font-semibold mb-2">Equipo B</div>
68-
<div className="text-2xl font-bold text-emerald-600">{match.teamB.score}</div>
69-
<div className="mt-2 text-sm text-gray-600">
74+
<div className="text-gray-700 font-semibold mb-2">Equipo B</div>
75+
<div className="text-3xl font-bold text-emerald-600">{match.teamB.score}</div>
76+
<div className="mt-2 text-sm text-gray-500">
7077
{match.teamB.players.map(p => p.name).join(', ')}
7178
</div>
7279
</div>
7380
</div>
74-
81+
82+
{/* Goals */}
7583
{match.goals.length > 0 && (
76-
<div className="mt-4 pt-4 border-t">
77-
<div className="flex items-center gap-2 mb-2">
78-
<Trophy className="w-4 h-4 text-yellow-500" />
79-
<span className="font-semibold">Goles</span>
84+
<div className="mt-6 pt-4 border-t border-gray-200">
85+
<div className="flex items-center gap-3 mb-3">
86+
<Trophy className="w-5 h-5 text-yellow-500" />
87+
<span className="text-lg font-semibold text-gray-700">Goles</span>
8088
</div>
81-
<div className="text-sm text-gray-600">
89+
<div className="text-sm text-gray-600 space-y-2">
8290
{match.goals.map((goal, index) => (
83-
<div key={index} className="mb-1">
91+
<div key={index}>
8492
{`${match.teamA.players.concat(match.teamB.players).find(p => p.id === goal.playerId)?.name} (${goal.minute}')`}
85-
{goal.assistById && ` - Asistencia: ${match.teamA.players.concat(match.teamB.players).find(p => p.id === goal.assistById)?.name}`}
93+
{goal.assistById && (
94+
<span className="text-gray-500"> - Asistencia: {match.teamA.players.concat(match.teamB.players).find(p => p.id === goal.assistById)?.name}</span>
95+
)}
8696
</div>
8797
))}
8898
</div>

0 commit comments

Comments
 (0)