Spaces:
Runtime error
Runtime error
File size: 2,007 Bytes
22a5b8c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
import {
Card,
CardHeader,
CardMedia,
CardContent,
Grid,
Link,
Table,
TableBody,
TableRow,
TableCell,
} from "@mui/material";
export interface Example {
title: string;
creatorLink: string;
creatorName: string;
image: string;
playLink: string;
model: string;
iterations: number;
controls: string;
hints: string;
}
interface ExamplesGridProps {
examples: Example[];
}
export default function ExamplesGrid({ examples }: ExamplesGridProps) {
return (
<Grid container spacing={2}>
{examples.map((example, index) => (
<Grid item sm={4} key={index}>
<Card sx={{ height: "100%" }}>
<CardHeader
title={example.title}
subheader={
<>
by{" "}
<Link href={example.creatorLink} target="_blank" rel="noopener">
{example.creatorName}
</Link>
</>
}
/>
<CardMedia component="img" image={example.image} height="384" />
<CardContent>
<Table>
<TableBody>
<TableRow>
<TableCell variant="head">Play</TableCell>
<TableCell>
{" "}
<Link
href={example.playLink}
target="_blank"
rel="noopener"
>
on CodeSandbox
</Link>
</TableCell>
</TableRow>
<TableRow>
<TableCell variant="head">Model</TableCell>
<TableCell>{example.model}</TableCell>
</TableRow>
<TableRow>
<TableCell variant="head">Iterations</TableCell>
<TableCell>{example.iterations}</TableCell>
</TableRow>
<TableRow>
<TableCell variant="head">Controls</TableCell>
<TableCell>{example.controls}</TableCell>
</TableRow>
<TableRow>
<TableCell variant="head">Hints</TableCell>
<TableCell>{example.hints}</TableCell>
</TableRow>
</TableBody>
</Table>
</CardContent>
</Card>
</Grid>
))}
</Grid>
);
}
|