|
| 1 | +import React from "react"; |
| 2 | +import { createStyles, makeStyles } from "@material-ui/core/styles"; |
| 3 | +import { Card, CardMedia, Typography } from "@material-ui/core"; |
| 4 | + |
| 5 | +const useStyles = makeStyles(() => |
| 6 | + createStyles({ |
| 7 | + root: { |
| 8 | + display: "flex", |
| 9 | + margin: "2vh", |
| 10 | + height: "65vh", |
| 11 | + width: "80vw", |
| 12 | + position: "relative", |
| 13 | + }, |
| 14 | + info: { |
| 15 | + width: "100%", |
| 16 | + height: "100%", |
| 17 | + position: "absolute", |
| 18 | + top: 0, |
| 19 | + background: "rgba(0, 0, 0, 0.63)", |
| 20 | + backdropFilter: "blur(10px)", |
| 21 | + color: "white", |
| 22 | + padding: "6% 0 0 10%", |
| 23 | + }, |
| 24 | + title: { |
| 25 | + fontSize: "2rem", |
| 26 | + textDecoration: "none", |
| 27 | + fontWeight: "bold", |
| 28 | + color: "white", |
| 29 | + fontFamily: "monospace", |
| 30 | + }, |
| 31 | + lang: { |
| 32 | + opacity: 0.5, |
| 33 | + marginTop: "1vh", |
| 34 | + fontSize: "1rem", |
| 35 | + fontFamily: "monospace", |
| 36 | + }, |
| 37 | + body: { |
| 38 | + marginTop: "5vh", |
| 39 | + fontSize: "1rem", |
| 40 | + width: "80%", |
| 41 | + fontFamily: "monospace", |
| 42 | + }, |
| 43 | + owner: { |
| 44 | + marginTop: "5vh", |
| 45 | + fontSize: "1rem", |
| 46 | + opacity: 0.5, |
| 47 | + fontFamily: "monospace", |
| 48 | + }, |
| 49 | + media: { |
| 50 | + width: "100%", |
| 51 | + height: "100%", |
| 52 | + }, |
| 53 | + }) |
| 54 | +); |
| 55 | + |
| 56 | +interface ProjectCardv3Props { |
| 57 | + projectName: string; |
| 58 | + lang: string; |
| 59 | + description: string; |
| 60 | + dev: string; |
| 61 | + url: string; |
| 62 | + image: string; |
| 63 | +} |
| 64 | +const ProjectCardv3: React.FC<ProjectCardv3Props> = ({ |
| 65 | + projectName, |
| 66 | + lang, |
| 67 | + description, |
| 68 | + dev, |
| 69 | + url, |
| 70 | + image, |
| 71 | +}) => { |
| 72 | + const classes = useStyles(); |
| 73 | + const [display, setDisplay] = React.useState<string>("none"); |
| 74 | + |
| 75 | + return ( |
| 76 | + <Card className={classes.root}> |
| 77 | + <div |
| 78 | + style={{ display }} |
| 79 | + onMouseLeave={() => setDisplay("none")} |
| 80 | + className={classes.info} |
| 81 | + > |
| 82 | + <a href={url} className={classes.title} target="_blank"> |
| 83 | + <Typography className={classes.title}>{projectName}</Typography> |
| 84 | + </a> |
| 85 | + <Typography className={classes.lang}>{lang}</Typography> |
| 86 | + <Typography className={classes.body}>{description}</Typography> |
| 87 | + <Typography className={classes.owner}>{dev}</Typography> |
| 88 | + </div> |
| 89 | + <CardMedia |
| 90 | + onMouseEnter={() => setDisplay("block")} |
| 91 | + image={image} |
| 92 | + className={classes.media} |
| 93 | + /> |
| 94 | + </Card> |
| 95 | + ); |
| 96 | +}; |
| 97 | + |
| 98 | +export default ProjectCardv3; |
0 commit comments