Skip to content

Commit e25e910

Browse files
committed
Add GitHub contributions to the list
1 parent 1e604bd commit e25e910

File tree

3 files changed

+66
-3
lines changed

3 files changed

+66
-3
lines changed

src/components/Member/ListItem.js

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Grid from '@material-ui/core/Grid';
1919
import ListItem from 'app/components/List/Item';
2020
import Stats from 'app/components/Member/Stats';
2121
import getPlural from 'app/utils';
22+
import { GITHUB_URL } from 'app/config';
2223
import moment from 'moment';
2324

2425
const styles = theme => ({
@@ -43,6 +44,41 @@ const styles = theme => ({
4344
fontSize: '1.5rem'
4445
}
4546
},
47+
smallGithubContributions: {
48+
fontSize: '0.4rem'
49+
},
50+
smallGithubRepo: {
51+
padding: '2px'
52+
},
53+
githubContainer: {
54+
width: '60%',
55+
[theme.breakpoints.down('lg')]: {
56+
width: '80%'
57+
},
58+
[theme.breakpoints.down('md')]: {
59+
width: '60%'
60+
},
61+
[theme.breakpoints.down('sm')]: {
62+
width: '100%'
63+
}
64+
},
65+
githubRepoName: {
66+
color: 'white',
67+
fontWeight: 'bold'
68+
},
69+
githubContributions: {
70+
opacity: 0.6,
71+
fontSize: '0.8rem',
72+
[theme.breakpoints.down('lg')]: {
73+
fontSize: '0.65rem'
74+
},
75+
[theme.breakpoints.down('md')]: {
76+
fontSize: '0.5rem'
77+
},
78+
[theme.breakpoints.down('sm')]: {
79+
fontSize: '0.5rem'
80+
}
81+
},
4682
firstSeen: {
4783
fontSize: '0.6rem',
4884
opacity: 0.7
@@ -93,6 +129,7 @@ const Item = props => {
93129
avatar,
94130
name,
95131
github,
132+
githubContributions,
96133
brusData,
97134
kaffeData,
98135
birthday,
@@ -141,11 +178,31 @@ const Item = props => {
141178
isLegoDay={isLegoDay}
142179
>
143180
<span>{name}</span>
144-
<span>
181+
<div className={classes.githubContainer}>
145182
<FontAwesomeIcon className={classes.statsIcon} icon={faGithub} />
146183
<span> </span>
147-
<a href={`https://github.com/${github}`}>@{github}</a>
148-
</span>
184+
<a href={`${GITHUB_URL}/${github}`}>@{github}</a>
185+
{width !== 'xs' && (
186+
<Grid
187+
container
188+
direction={'row'}
189+
justify={'space-between'}
190+
className={classes.githubContributions}
191+
>
192+
{githubContributions.map(item => (
193+
<div key={`contributions-${github}-${item.repository}`}>
194+
<a
195+
href={`${GITHUB_URL}/${item.repository}`}
196+
className={classes.githubRepoName}
197+
>
198+
{item.repository.replace('webkom/', '')}:
199+
</a>{' '}
200+
{item.contributions}
201+
</div>
202+
))}
203+
</Grid>
204+
)}
205+
</div>
149206
{width === 'xs' && (
150207
<Grid
151208
container
@@ -262,6 +319,7 @@ Item.propTypes = {
262319
kaffeData: PropTypes.object.isRequired,
263320
activityToday: PropTypes.string.isRequired,
264321
lastSeen: PropTypes.string.isRequired,
322+
githubContributions: PropTypes.object,
265323
firstSeen: PropTypes.object,
266324
birthday: PropTypes.object,
267325
firstLegoCommit: PropTypes.object,

src/components/Member/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const Member = props => {
2020
avatar={member.avatar}
2121
name={member.name}
2222
github={member.github}
23+
githubContributions={member.github_contributions}
2324
brusData={member.brus_data}
2425
kaffeData={member.kaffe_data}
2526
birthday={

src/config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// GitHub base URL
2+
export const GITHUB_URL =
3+
process.env.REACT_APP_GITHUB_URL || 'https://github.com';
4+
15
// Brus API
26
export const BRUS_URL =
37
process.env.REACT_APP_BRUS_URL || 'https://brus.abakus.no';

0 commit comments

Comments
 (0)