|
| 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; |
0 commit comments