@@ -4,89 +4,78 @@ import { FC } from 'react';
44import { CardProps , Card , Button } from 'react-bootstrap' ;
55import { formatDate } from 'web-utility' ;
66
7- import { timeOf } from './Hackathon/utility' ;
87import { Product } from '../../models/Hackathon' ;
98import styles from '../../styles/Hackathon.module.less' ;
109
1110export type ProductCardProps = Product & Omit < CardProps , 'id' | 'title' > ;
1211
1312export const ProductCard : FC < ProductCardProps > = observer (
14- ( { className = '' , id, createdAt, name, sourceLink, link = sourceLink , summary, ...props } ) => {
15- const createdAtTime = timeOf ( createdAt ) ;
16- const createdAtISO = Number . isFinite ( createdAtTime )
17- ? new Date ( createdAtTime ) . toJSON ( )
18- : undefined ;
19- const createdAtText = Number . isFinite ( createdAtTime ) ? formatDate ( createdAtTime ) : '' ;
13+ ( { className = '' , id, createdAt, name, sourceLink, link = sourceLink , summary, ...props } ) => (
14+ < Card className = { `${ styles . projectCard } ${ className } ` } { ...props } >
15+ < Card . Body className = "d-flex flex-column" >
16+ < Card . Title
17+ as = "a"
18+ className = "text-dark fw-bold"
19+ title = { name as string }
20+ target = "_blank"
21+ href = { link as string }
22+ >
23+ { ( name || link ) as string }
24+ </ Card . Title >
25+ < p className = "text-dark opacity-75 mb-3" > { summary as string } </ p >
26+ < div className = "flex-fill mb-3" >
27+ < FilePreview className = "w-100" path = { link as string } />
28+ </ div >
2029
21- return (
22- < Card className = { `${ styles . projectCard } ${ className } ` } { ...props } >
23- < Card . Body className = "d-flex flex-column" >
24- < Card . Title
25- as = "a"
26- className = "text-dark fw-bold"
27- title = { name as string }
28- target = "_blank"
29- href = { link as string }
30- >
31- { ( name || link ) as string }
32- </ Card . Title >
33- < p className = "text-dark opacity-75 mb-3" > { summary as string } </ p >
34- < div className = "flex-fill mb-3" >
35- < FilePreview className = "w-100" path = { link as string } />
30+ { sourceLink && (
31+ < div className = "d-flex flex-wrap gap-2 mb-3" >
32+ < Button
33+ variant = "dark"
34+ size = "sm"
35+ href = { sourceLink as string }
36+ target = "_blank"
37+ rel = "noreferrer"
38+ >
39+ GitHub
40+ </ Button >
41+ < Button
42+ variant = "primary"
43+ size = "sm"
44+ href = { `https://github.dev/${ ( sourceLink as string ) . replace ( 'https://github.com/' , '' ) } ` }
45+ target = "_blank"
46+ rel = "noreferrer"
47+ >
48+ GitHub.dev
49+ </ Button >
50+ < Button
51+ variant = "dark"
52+ size = "sm"
53+ href = { `https://codespaces.new/${ ( sourceLink as string ) . replace ( 'https://github.com/' , '' ) } ` }
54+ target = "_blank"
55+ rel = "noreferrer"
56+ >
57+ Codespaces
58+ </ Button >
59+ < Button
60+ variant = "warning"
61+ size = "sm"
62+ href = { `https://gitpod.io/#${ sourceLink as string } ` }
63+ target = "_blank"
64+ rel = "noreferrer"
65+ >
66+ GitPod
67+ </ Button >
3668 </ div >
69+ ) }
3770
38- { sourceLink && (
39- < div className = "d-flex flex-wrap gap-2 mb-3" >
40- < Button
41- variant = "dark"
42- size = "sm"
43- href = { sourceLink as string }
44- target = "_blank"
45- rel = "noreferrer"
46- >
47- GitHub
48- </ Button >
49- < Button
50- variant = "primary"
51- size = "sm"
52- href = { `https://github.dev/${ ( sourceLink as string ) . replace ( 'https://github.com/' , '' ) } ` }
53- target = "_blank"
54- rel = "noreferrer"
55- >
56- GitHub.dev
57- </ Button >
58- < Button
59- variant = "dark"
60- size = "sm"
61- href = { `https://codespaces.new/${ ( sourceLink as string ) . replace ( 'https://github.com/' , '' ) } ` }
62- target = "_blank"
63- rel = "noreferrer"
64- >
65- Codespaces
66- </ Button >
67- < Button
68- variant = "warning"
69- size = "sm"
70- href = { `https://gitpod.io/#${ sourceLink as string } ` }
71- target = "_blank"
72- rel = "noreferrer"
73- >
74- GitPod
75- </ Button >
76- </ div >
77- ) }
78-
79- { createdAtISO && (
80- < time
81- suppressHydrationWarning
82- className = "text-dark opacity-75 small"
83- dateTime = { createdAtISO }
84- >
85- 📅 { createdAtText }
86- </ time >
87- ) }
88- </ Card . Body >
89- </ Card >
90- ) ;
91- } ,
71+ < time
72+ suppressHydrationWarning
73+ className = "text-dark opacity-75 small"
74+ dateTime = { new Date ( createdAt as number ) . toJSON ( ) }
75+ >
76+ 📅 { formatDate ( createdAt as number ) }
77+ </ time >
78+ </ Card . Body >
79+ </ Card >
80+ ) ,
9281) ;
0 commit comments