@@ -5,93 +5,73 @@ import { CardProps, Card, Button } from 'react-bootstrap';
55import { formatDate } from 'web-utility' ;
66
77import { Product } from '../../models/Hackathon' ;
8+ import styles from '../../styles/Hackathon.module.less' ;
89
910export type ProductCardProps = Product & Omit < CardProps , 'id' | 'title' > ;
1011
1112export const ProductCard : FC < ProductCardProps > = observer (
12- ( { className = '' , id, createdAt, name, sourceLink, link = sourceLink , summary, ...props } ) => {
13- if ( ! sourceLink ) return null ;
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 >
1429
15- return (
16- < Card className = { `border-success ${ className } ` } { ...props } >
17- < Card . Body className = "d-flex flex-column" >
18- < Card . Title
19- as = "a"
20- className = "text-primary"
21- title = { name as string }
22- target = "_blank"
23- href = { link as string }
24- >
25- { ( name || link ) as string }
26- </ Card . Title >
27- < p className = "border-bottom p-2 text-muted text-truncate" > { summary as string } </ p >
28- < div className = "border-bottom py-2 my-2 flex-fill" >
29- < FilePreview className = "w-100" path = { link as string } />
30-
31- < div className = "d-flex flex-wrap gap-2 mt-2" >
32- < Button
33- variant = "dark"
34- size = "sm"
35- href = { sourceLink as string }
36- target = "_blank"
37- rel = "noreferrer"
38- >
39- < img
40- src = "https://img.shields.io/badge/GitHub-181717?logo=github"
41- alt = "GitHub"
42- style = { { height : '20px' } }
43- />
44- </ Button >
45- < Button
46- variant = "primary"
47- size = "sm"
48- href = { `https://github.dev/${ ( sourceLink as string ) . replace ( 'https://github.com/' , '' ) } ` }
49- target = "_blank"
50- rel = "noreferrer"
51- >
52- < img
53- src = "https://img.shields.io/badge/GitHub.dev-blue?logo=visualstudio"
54- alt = "GitHub.dev"
55- style = { { height : '20px' } }
56- />
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- < img
66- src = "https://img.shields.io/badge/GitHub_codespaces-black?logo=github"
67- alt = "GitHub Codespaces"
68- style = { { height : '20px' } }
69- />
70- </ Button >
71- < Button
72- variant = "warning"
73- size = "sm"
74- href = { `https://gitpod.io/#${ sourceLink as string } ` }
75- target = "_blank"
76- rel = "noreferrer"
77- >
78- < img
79- src = "https://img.shields.io/badge/GitPod.io-orange?logo=git"
80- alt = "GitPod"
81- style = { { height : '20px' } }
82- />
83- </ Button >
84- </ div >
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 >
8568 </ div >
86- < time
87- className = "d-block p-2 text-truncate"
88- dateTime = { new Date ( createdAt as number ) . toJSON ( ) }
89- >
90- 📅
91- { formatDate ( createdAt as number ) }
92- </ time >
93- </ Card . Body >
94- </ Card >
95- ) ;
96- } ,
69+ ) }
70+
71+ < time className = "text-dark opacity-75 small" dateTime = { new Date ( createdAt as number ) . toJSON ( ) } >
72+ 📅 { formatDate ( createdAt as number ) }
73+ </ time >
74+ </ Card . Body >
75+ </ Card >
76+ ) ,
9777) ;
0 commit comments