brackt/app/components/league/SportIcon.tsx
Chris Parsons 377b26a9c3 Extract reusable league wizard components; wire settings page (#103)
Extracts 9 domain components from new.tsx and $leagueId.settings.tsx into
app/components/league/ (each with a Storybook story), consolidates wizard
form-building into wizard-state.ts, and updates the settings page to use
the shared components instead of hand-rolled duplicates. new.tsx shrinks
from ~2000 → ~1280 lines.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 22:08:14 -07:00

20 lines
696 B
TypeScript

export interface SportIconProps {
sport: { name: string; iconUrl: string | null };
size?: "sm" | "md";
}
export function SportIcon({ sport, size = "md" }: SportIconProps) {
const cls = size === "sm" ? "w-4 h-4" : "w-5 h-5";
if (sport.iconUrl) {
const isAbsolute = sport.iconUrl.startsWith("data:") || sport.iconUrl.startsWith("http") || sport.iconUrl.startsWith("/");
const src = isAbsolute ? sport.iconUrl : `/sports-icons/${sport.iconUrl}`;
return (
<img
src={src}
alt={sport.name}
className={`${cls} object-contain shrink-0`}
/>
);
}
return <span className={`${cls} rounded-sm bg-muted shrink-0 inline-block`} aria-hidden />;
}