flags local

This commit is contained in:
2026-06-24 22:25:08 -05:00
parent c848d5a7b5
commit a106f28257
53 changed files with 2276 additions and 6 deletions

View File

@@ -1,15 +1,17 @@
"use client";
import { useState } from "react";
import { Team } from "@/lib/types";
// Zeigt die Flagge/das Wappen eines Teams. Fällt auf ein neutrales Rund
// zurück, wenn keine crest-URL vorliegt. SVG-Crests (football-data) skalieren
// sauber; das Rendern als rundes Bild gibt den Flaggen-Look aus dem Screenshot.
// zurück, wenn keine crest-URL vorliegt oder das Bild nicht geladen werden kann.
export default function Flag({
team, size = 22,
}: { team?: Team; size?: number }) {
const [imgFailed, setImgFailed] = useState(false);
const style = { width: size, height: size } as const;
if (team?.crest) {
if (team?.crest && !imgFailed) {
return (
<img
src={team.crest}
@@ -17,6 +19,7 @@ export default function Flag({
className="flag"
style={style}
loading="lazy"
onError={() => setImgFailed(true)}
/>
);
}