Skip to content

Commit ac89dbc

Browse files
Thank you contributors (#125)
* added thank you card for contributors * removed security risk * shifted contributors url to a different file
1 parent 054f554 commit ac89dbc

File tree

3 files changed

+97
-3
lines changed

3 files changed

+97
-3
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const contributorsUrl = "https://api.github.com/repos/shravan20/github-readme-quotes/contributors?"
2+
3+
export {contributorsUrl}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import React, { useState, useEffect } from "react";
2+
import { makeStyles } from "@material-ui/core/styles";
3+
import Card from "@material-ui/core/Card";
4+
import CardActions from "@material-ui/core/CardActions";
5+
import CardContent from "@material-ui/core/CardContent";
6+
import Button from "@material-ui/core/Button";
7+
import Typography from "@material-ui/core/Typography";
8+
import Avatar from "@material-ui/core/Avatar";
9+
import {contributorsUrl} from "../Constants/urlConfig"
10+
11+
const useStyles = makeStyles({
12+
root: {
13+
// minWidth: 275,
14+
maxWidth: 400,
15+
padding: 10,
16+
margin: 10,
17+
border:'10px'
18+
},
19+
bullet: {
20+
display: "inline-block",
21+
margin: "0 2px",
22+
transform: "scale(0.8)",
23+
},
24+
title: {
25+
fontSize: 14,
26+
},
27+
pos: {
28+
marginBottom: 12,
29+
},
30+
});
31+
32+
const ContributorsCard = () => {
33+
const [listOfContributors,setListOfContributors] = useState([]);
34+
useEffect(()=>{
35+
fetch(contributorsUrl)
36+
.then((res)=>res.json())
37+
.then((data)=>{
38+
setListOfContributors(data);
39+
})
40+
},[]);
41+
42+
43+
44+
const classes = useStyles();
45+
return (
46+
<div
47+
style={{
48+
display: "flex",
49+
margin:"10px",
50+
justifyContent: "center",
51+
alignItems: "center",
52+
}}
53+
>
54+
<Card raised className={classes.root}>
55+
<CardContent>
56+
A Special Thanks To All The Contributors!
57+
<Typography variant="h5" component="h2">
58+
We are grateful{" "}
59+
<span role="img" aria-label="sheep">
60+
❤️
61+
</span>
62+
</Typography>
63+
<Typography className={classes.pos} color="textSecondary">
64+
To our {listOfContributors.length} contributors for helping in
65+
<br />
66+
bringing this project to life
67+
</Typography>
68+
69+
<div style={{display:'flex',alignItems:'center'}}>
70+
71+
{
72+
listOfContributors.slice(0,Math.min(listOfContributors.length,7)).map((contributor)=>{
73+
return(
74+
<Avatar style={{marginRight:'5px',MarginLeft:'5px'}} alt={contributor.login} src={contributor.avatar_url} />
75+
76+
)
77+
})
78+
}
79+
</div>
80+
</CardContent>
81+
<CardActions>
82+
<a style={{textDecoration:"none"}} href="https://github.com/shravan20/github-readme-quotes/graphs/contributors">
83+
<Button variant="contained" color="primary" size="small">More Details Here</Button>
84+
</a>
85+
</CardActions>
86+
</Card>
87+
</div>
88+
);
89+
};
90+
91+
export default ContributorsCard;

frontend/src/components/Pages/Home/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import TemplateCard from '../../organisms/TemplateCard';
44
import { themes, animations, layouts, fonts } from '../../../config/cardTemplate';
55
import TextField from '@material-ui/core/TextField';
66
import Autocomplete from '@material-ui/lab/Autocomplete';
7-
7+
import ContributorsCard from '../../ContributorsCard/ContributorCard'
88
const Home = () => {
99

1010
const [theme, setTheme] = useState(themes[0]);
@@ -15,7 +15,7 @@ const Home = () => {
1515
return (
1616
<React.Fragment>
1717
<Typography variant='h5' align='center' component='h2' style={{ margin: '20px' }}>Make your own personalised style for the Quotes</Typography>
18-
18+
1919
<Grid
2020
container
2121
alignItems="center"
@@ -96,7 +96,7 @@ const Home = () => {
9696
})
9797
}
9898
</Grid>
99-
99+
<ContributorsCard />
100100
</React.Fragment>
101101
)
102102
}

0 commit comments

Comments
 (0)