MCPcopy Create free account
hub / github.com/codealong-dev/ride-sharing / DriverCard

Function DriverCard

web/src/components/DriverCard.tsx:5–44  ·  view source on GitHub ↗
({ driver, packageSlug }: { driver?: Driver | null, packageSlug?: CarPackageSlug })

Source from the content-addressed store, hash-verified

3import { Card, CardContent, CardHeader, CardTitle } from "./ui/card";
4
5export const DriverCard = ({ driver, packageSlug }: { driver?: Driver | null, packageSlug?: CarPackageSlug }) => {
6 if (!driver) return null;
7
8 const CarPlate = ({ plate }: { plate: string }) => (
9 <span className="inline-flex items-center px-2.5 py-0.5 rounded-md text-sm font-medium bg-gray-100 text-gray-800 font-mono tracking-wider">
10 {plate.toUpperCase()}
11 </span>
12 );
13
14 return (
15 <Card className="">
16 <CardHeader>
17 <CardTitle>{driver.name}</CardTitle>
18 </CardHeader>
19 <CardContent className="flex flex-col gap-2 items-center">
20 {driver.profilePicture && (
21 <Image
22 className="rounded-full"
23 src={driver.profilePicture}
24 alt={`${driver.name}'s profile picture`}
25 width={50}
26 height={50}
27 />
28 )}
29
30 {driver.carPlate && (
31 <p className="text-sm">
32 <CarPlate plate={driver.carPlate} />
33 </p>
34 )}
35
36 {packageSlug && (
37 <p className="text-sm">
38 <span className="font-mono">{packageSlug}</span> driver
39 </p>
40 )}
41 </CardContent>
42 </Card>
43 )
44};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected