import * as React from "react" import clsx from "clsx" import type { Coach } from "../types/Coach" import PawnIcon from "../icons/Pawn" import KnightIcon from "../icons/Knight" function getSiteIcon(coach: Coach) { switch (coach.site) { case "chesscom": return ({ className, ...props }: { className?: string }) => ( ) case "lichess": return ({ className, ...props }: { className?: string }) => ( ) default: return null } } function getProfileUrl(coach: Coach) { switch (coach.site) { case "chesscom": return `https://www.chess.com/member/${coach.username}` case "lichess": return `https://lichess.org/coach/${coach.username}` default: return "" } } export function SearchResult({ coach }: { coach: Coach }) { const profileUrl = getProfileUrl(coach) const Component = profileUrl ? "a" : "div" const Icon = getSiteIcon(coach) return ( {Icon && (
)}
{coach.name ? (

{coach.title ? ( {coach.title} ) : null} {coach.name}

) : null}

{coach.username}

) }