48 lines
2.3 KiB
PHP
48 lines
2.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Einzelnes Spiel (Begegnung) als Karte. Props:
|
||
|
|
* $match Eintrag aus data/matchcenter.json (next_matches[]/last_results[]/upcoming[])
|
||
|
|
* $variant '' (Default) | 'hero' (groß, für den Slider)
|
||
|
|
* Aufbau (kicker-Stil): Datum oben mittig, darunter Heim | Ergebnis/Anstoß | Gast,
|
||
|
|
* die Zeit mittig unter dem Ergebnis. Die Heimmannschaft steht immer links — daher
|
||
|
|
* kein zusätzlicher Heim/Auswärts-Hinweis. Die eigene Mannschaft wird hervorgehoben.
|
||
|
|
*/
|
||
|
|
$variant = $variant ?? '';
|
||
|
|
$m = $match;
|
||
|
|
$hasResult = isset($m['goals_home'], $m['goals_away']);
|
||
|
|
$isHome = !empty($m['is_home']);
|
||
|
|
|
||
|
|
$classes = 'match-card';
|
||
|
|
if ($variant !== '') {
|
||
|
|
$classes .= ' match-card--' . preg_replace('/[^a-z0-9-]+/', '', strtolower($variant));
|
||
|
|
}
|
||
|
|
?>
|
||
|
|
<article class="<?= $classes ?>">
|
||
|
|
<?php if (!empty($m['date_display'])): ?>
|
||
|
|
<p class="match-card__date"><?= icon('calendar-event', 'match-card__date-icon') ?><?= e($m['date_display']) ?></p>
|
||
|
|
<?php endif; ?>
|
||
|
|
<div class="match-card__fixture">
|
||
|
|
<div class="match-card__side<?= $isHome ? ' is-own' : '' ?>">
|
||
|
|
<?php component('crest', ['src' => $m['home_crest'] ?? null, 'name' => $m['home'] ?? '']); ?>
|
||
|
|
<span class="match-card__club"><?= e($m['home'] ?? '') ?></span>
|
||
|
|
</div>
|
||
|
|
<div class="match-card__center">
|
||
|
|
<?php if ($hasResult): ?>
|
||
|
|
<span class="match-card__score"><?= (int) $m['goals_home'] ?><span class="match-card__colon">:</span><?= (int) $m['goals_away'] ?></span>
|
||
|
|
<?php else: ?>
|
||
|
|
<span class="match-card__vs" aria-label="gegen">:</span>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php if (!empty($m['time_display'])): ?>
|
||
|
|
<span class="match-card__time"><?= e($m['time_display']) ?></span>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
<div class="match-card__side<?= !$isHome ? ' is-own' : '' ?>">
|
||
|
|
<?php component('crest', ['src' => $m['away_crest'] ?? null, 'name' => $m['away'] ?? '']); ?>
|
||
|
|
<span class="match-card__club"><?= e($m['away'] ?? '') ?></span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</article>
|