dwysokinski.me/src/features/IndexPage/components/Portfolio/Project.js

133 lines
3.0 KiB
JavaScript
Raw Normal View History

2021-01-17 08:31:50 +00:00
import React from 'react';
import PropTypes from 'prop-types';
2020-07-13 17:04:46 +00:00
2021-01-17 08:31:50 +00:00
import { makeStyles } from '@material-ui/core/styles';
2020-07-13 17:04:46 +00:00
import {
Button,
2020-07-13 17:04:46 +00:00
Card,
CardContent,
Chip,
Link,
Typography,
2021-01-17 08:31:50 +00:00
} from '@material-ui/core';
import BackgroundImage from 'gatsby-background-image';
2020-07-13 17:04:46 +00:00
function Project({ title, description, technologies, git, live, fluid }) {
2021-01-17 08:31:50 +00:00
const classes = useStyles();
2020-07-13 17:04:46 +00:00
return (
<Card className={classes.card}>
{
<BackgroundImage
fluid={fluid}
title={title}
className={classes.cover}
/>
}
2020-07-13 17:04:46 +00:00
<CardContent className={classes.cardContent}>
<div className={classes.contentContainer}>
<Typography variant="h3" gutterBottom className={classes.title}>
{title}
2020-07-13 17:04:46 +00:00
</Typography>
<Typography>{description}</Typography>
2020-07-13 17:04:46 +00:00
</div>
<div className={classes.divider} />
2020-07-13 17:04:46 +00:00
<div className={classes.technologies}>
{technologies.map(technology => {
return (
<Chip key={technology} label={technology} color="secondary" />
2021-01-17 08:31:50 +00:00
);
})}
2020-07-13 17:04:46 +00:00
</div>
<div className={classes.buttons}>
{git && (
<Link underline="none" href={git}>
<Button variant="contained" color="secondary">
Git
</Button>
</Link>
)}
{live && (
<Link underline="none" href={live}>
<Button variant="contained" color="secondary">
Online
</Button>
</Link>
)}
2020-07-13 17:04:46 +00:00
</div>
</CardContent>
</Card>
2021-01-17 08:31:50 +00:00
);
2020-07-13 17:04:46 +00:00
}
const useStyles = makeStyles(theme => ({
card: {
2021-01-17 08:31:50 +00:00
display: 'flex',
minHeight: '400px',
flexDirection: 'column',
height: '100%',
},
cardContent: {
2021-01-17 08:31:50 +00:00
display: 'flex',
flexDirection: 'column',
height: '100%',
},
divider: {
flex: 1,
},
title: {
overflowWrap: 'break-word',
wordWrap: 'break-word',
'-ms-word-break': 'break-all',
wordBreak: 'break-word',
'-ms-hyphens': 'auto',
'-moz-hyphens': 'auto',
'-webkit-hyphens': 'auto',
hyphens: 'auto',
},
contentContainer: {
marginBottom: theme.spacing(8),
},
technologies: {
marginBottom: theme.spacing(2),
2021-01-17 08:31:50 +00:00
'& > *:not(:last-child)': {
marginRight: theme.spacing(1),
},
2021-01-17 08:31:50 +00:00
'& > *': {
marginBottom: theme.spacing(1),
},
},
buttons: {
2021-01-17 08:31:50 +00:00
'& > *:not(:last-child)': {
marginRight: theme.spacing(1),
},
2021-01-17 08:31:50 +00:00
'& > *': {
marginBottom: theme.spacing(1),
2021-01-17 08:31:50 +00:00
[theme.breakpoints.down('xs')]: {
width: '100%',
},
},
},
cover: {
width: '100%',
paddingTop: '66.6666%',
},
2021-01-17 08:31:50 +00:00
}));
2020-07-13 17:04:46 +00:00
Project.defaultProps = {
2021-01-17 08:31:50 +00:00
title: '',
description: '',
technologies: [],
2021-01-17 08:31:50 +00:00
github: '',
live: '',
};
Project.propTypes = {
title: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
technologies: PropTypes.arrayOf(PropTypes.string).isRequired,
github: PropTypes.string.isRequired,
live: PropTypes.string.isRequired,
2021-01-17 08:31:50 +00:00
};
2020-07-13 17:04:46 +00:00
2021-01-17 08:31:50 +00:00
export default Project;