-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathProductCard.tsx
More file actions
44 lines (40 loc) · 1.45 KB
/
ProductCard.tsx
File metadata and controls
44 lines (40 loc) · 1.45 KB
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
import { observer } from 'mobx-react';
import { FilePreview } from 'mobx-restful-table';
import { FC } from 'react';
import { CardProps, Card, Button } from 'react-bootstrap';
import { formatDate } from 'web-utility';
import { Product } from '../../models/Hackathon';
export type ProductCardProps = Product & Omit<CardProps, 'id' | 'title'>;
export const ProductCard: FC<ProductCardProps> = observer(
({ className = '', id, createdAt, name, sourceLink, link = sourceLink, summary, ...props }) => (
<Card className={`border-success ${className}`} {...props}>
<Card.Body className="d-flex flex-column">
<Card.Title
as="a"
className="text-primary"
title={name as string}
target="_blank"
href={link as string}
>
{(name || link) as string}
</Card.Title>
<p className="border-bottom p-2 text-muted text-truncate">{summary as string}</p>
<div className="border-bottom py-2 my-2 flex-fill">
<FilePreview className="w-100" path={link as string} />
{sourceLink && (
<Button variant="success" size="sm" href={sourceLink as string}>
🔗 Git
</Button>
)}
</div>
<time
className="d-block p-2 text-truncate"
dateTime={new Date(createdAt as number).toJSON()}
>
📅
{formatDate(createdAt as number)}
</time>
</Card.Body>
</Card>
),
);