11import { text2color } from 'idea-react' ;
22import { GitRepository } from 'mobx-github' ;
33import { observer } from 'mobx-react' ;
4- import { FC } from 'react' ;
4+ import { FC , useContext } from 'react' ;
55import { Badge , Button , Card , CardProps , Col , Row } from 'react-bootstrap' ;
66
7- import { t } from '../../models/Translation' ;
7+ import { I18nContext } from '../../models/Translation' ;
88import { GitLogo } from './Logo' ;
99
1010export interface GitCardProps
@@ -24,45 +24,49 @@ export const GitCard: FC<GitCardProps> = observer(
2424 description,
2525 homepage,
2626 ...props
27- } ) => (
28- < Card className = { className } { ...props } >
29- < Card . Body className = "d-flex flex-column gap-3" >
30- < Card . Title as = "h3" className = "h5" >
31- < a target = "_blank" href = { html_url } rel = "noreferrer" >
32- { full_name }
33- </ a >
34- </ Card . Title >
27+ } ) => {
28+ const { t } = useContext ( I18nContext ) ;
3529
36- < nav className = "flex-fill" >
37- { topics . map ( topic => (
38- < Badge
39- key = { topic }
40- className = "me-1 text-decoration-none"
41- bg = { text2color ( topic , [ 'light' ] ) }
42- as = "a"
43- target = "_blank"
44- href = { `https://github.com/topics/${ topic } ` }
45- >
46- { topic }
47- </ Badge >
48- ) ) }
49- </ nav >
50- < Row as = "ul" className = "list-unstyled g-4" xs = { 4 } >
51- { languages . map ( language => (
52- < Col key = { language } as = "li" >
53- < GitLogo name = { language } />
54- </ Col >
55- ) ) }
56- </ Row >
57- < Card . Text > { description } </ Card . Text >
58- </ Card . Body >
59- < Card . Footer className = "d-flex justify-content-between align-items-center" >
60- { homepage && (
61- < Button variant = "success" target = "_blank" href = { homepage } >
62- { t ( 'home_page' ) }
63- </ Button >
64- ) }
65- </ Card . Footer >
66- </ Card >
67- ) ,
30+ return (
31+ < Card className = { className } { ...props } >
32+ < Card . Body className = "d-flex flex-column gap-3" >
33+ < Card . Title as = "h3" className = "h5" >
34+ < a target = "_blank" href = { html_url } rel = "noreferrer" >
35+ { full_name }
36+ </ a >
37+ </ Card . Title >
38+
39+ < nav className = "flex-fill" >
40+ { topics . map ( topic => (
41+ < Badge
42+ key = { topic }
43+ className = "me-1 text-decoration-none"
44+ bg = { text2color ( topic , [ 'light' ] ) }
45+ as = "a"
46+ target = "_blank"
47+ href = { `https://github.com/topics/${ topic } ` }
48+ >
49+ { topic }
50+ </ Badge >
51+ ) ) }
52+ </ nav >
53+ < Row as = "ul" className = "list-unstyled g-4" xs = { 4 } >
54+ { languages . map ( language => (
55+ < Col key = { language } as = "li" >
56+ < GitLogo name = { language } />
57+ </ Col >
58+ ) ) }
59+ </ Row >
60+ < Card . Text > { description } </ Card . Text >
61+ </ Card . Body >
62+ < Card . Footer className = "d-flex justify-content-between align-items-center" >
63+ { homepage && (
64+ < Button variant = "success" target = "_blank" href = { homepage } >
65+ { t ( 'home_page' ) }
66+ </ Button >
67+ ) }
68+ </ Card . Footer >
69+ </ Card >
70+ ) ;
71+ } ,
6872) ;
0 commit comments