update preview images, render projects using material-ui's grid

This commit is contained in:
Dawid Wysokiński 2021-04-20 21:33:43 +02:00
parent a98451d58a
commit 02c3ed85f1
6 changed files with 40 additions and 54 deletions

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useStaticQuery, graphql } from 'gatsby'; import { useStaticQuery, graphql } from 'gatsby';
import { makeStyles } from '@material-ui/core/styles'; import { makeStyles } from '@material-ui/core/styles';
import { Typography, Container } from '@material-ui/core'; import { Typography, Container, Grid } from '@material-ui/core';
import Section, { BG_COLOR } from '@components/Section'; import Section, { BG_COLOR } from '@components/Section';
import Project from './Project'; import Project from './Project';
@ -18,9 +18,11 @@ const useStyles = makeStyles(theme => ({
margin: '3rem 0', margin: '3rem 0',
}, },
}, },
projects: { gridItem: {
'& > *:not(:last-child)': { [theme.breakpoints.up(750)]: {
marginBottom: theme.spacing(2), flexGrow: 0,
flexBasis: '50%',
maxWidth: '50%',
}, },
}, },
})); }));
@ -39,7 +41,7 @@ function Portfolio() {
relativePath relativePath
childImageSharp { childImageSharp {
id id
fluid(maxWidth: 1000) { fluid(maxWidth: 1280) {
...GatsbyImageSharpFluid ...GatsbyImageSharpFluid
} }
} }
@ -58,8 +60,8 @@ function Portfolio() {
<Typography variant="h2" align="center" gutterBottom> <Typography variant="h2" align="center" gutterBottom>
My work My work
</Typography> </Typography>
<div className={classes.projects}> <Grid container spacing={3}>
{projects.map((project, index) => { {projects.map(project => {
let fluid = undefined; let fluid = undefined;
if (project.fluid) { if (project.fluid) {
const edge = data.allCoverImages.edges.find( const edge = data.allCoverImages.edges.find(
@ -71,15 +73,17 @@ function Portfolio() {
} }
return ( return (
<Project <Grid
key={project.title} key={project.title}
{...project} item
fluid={fluid} xs={12}
reverse={(index + 1) % 2 === 0} className={classes.gridItem}
/> >
<Project {...project} fluid={fluid} />
</Grid>
); );
})} })}
</div> </Grid>
</Container> </Container>
</Section> </Section>
); );
@ -121,26 +125,19 @@ const projects = [
'GraphQL', 'GraphQL',
'Golang', 'Golang',
'gqlgen', 'gqlgen',
'Echo', 'Gin',
'PostgreSQL', 'PostgreSQL',
'TypeScript',
'React', 'React',
'React Native',
'Next.JS', 'Next.JS',
'Material-UI', 'Material-UI',
'Apollo', 'Apollo',
'React Native',
], ],
github: '', github: '',
fluid: 'projects/zdam.png', fluid: 'projects/zdam.png',
live: 'https://zdamegzaminzawodowy.pl/', live: 'https://zdamegzaminzawodowy.pl/',
}, },
{
title: 'matura-z-informatyki.pl',
description: '',
technologies: ['React', 'Next.JS', 'Bulma', 'Ghost'],
github: 'https://github.com/Kichiyaki/matura-z-informatyki.pl',
live: 'https://matura-z-informatyki.pl/',
fluid: 'projects/maturazinf.png',
},
{ {
title: 'dwysokinski.me', title: 'dwysokinski.me',
description: '', description: '',

View File

@ -1,22 +1,20 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classnames from 'classnames';
import notFound from './not-found.jpg'; import notFound from './not-found.jpg';
import { makeStyles } from '@material-ui/core/styles'; import { makeStyles } from '@material-ui/core/styles';
import { import {
Button,
Card, Card,
CardContent, CardContent,
CardMedia, CardMedia,
Typography,
Button,
Chip, Chip,
Link, Link,
Typography,
} from '@material-ui/core'; } from '@material-ui/core';
import BackgroundImage from 'gatsby-background-image'; import BackgroundImage from 'gatsby-background-image';
function Project({ function Project({
reverse,
title, title,
description, description,
technologies, technologies,
@ -27,11 +25,7 @@ function Project({
}) { }) {
const classes = useStyles(); const classes = useStyles();
return ( return (
<Card <Card className={classes.card}>
className={classnames(classes.card, {
reverse,
})}
>
{fluid ? ( {fluid ? (
<BackgroundImage <BackgroundImage
fluid={fluid} fluid={fluid}
@ -43,12 +37,12 @@ function Project({
)} )}
<CardContent className={classes.cardContent}> <CardContent className={classes.cardContent}>
<div className={classes.contentContainer}> <div className={classes.contentContainer}>
<Typography variant="h3" gutterBottom> <Typography variant="h3" gutterBottom className={classes.title}>
{title} {title}
</Typography> </Typography>
<Typography>{description}</Typography> <Typography>{description}</Typography>
</div> </div>
<div className={classes.divider}></div> <div className={classes.divider} />
<div className={classes.technologies}> <div className={classes.technologies}>
{technologies.map(technology => { {technologies.map(technology => {
return ( return (
@ -81,27 +75,27 @@ const useStyles = makeStyles(theme => ({
card: { card: {
display: 'flex', display: 'flex',
minHeight: '400px', minHeight: '400px',
'&.reverse': { flexDirection: 'column',
flexDirection: 'row-reverse', height: '100%',
[theme.breakpoints.down('sm')]: {
flexDirection: 'column',
},
},
[theme.breakpoints.down('sm')]: {
flexDirection: 'column',
},
}, },
cardContent: { cardContent: {
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
width: '45%', height: '100%',
[theme.breakpoints.down('sm')]: {
width: '100%',
},
}, },
divider: { divider: {
flex: 1, 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: { contentContainer: {
marginBottom: theme.spacing(8), marginBottom: theme.spacing(8),
}, },
@ -126,16 +120,12 @@ const useStyles = makeStyles(theme => ({
}, },
}, },
cover: { cover: {
width: '55%', width: '100%',
[theme.breakpoints.down('sm')]: { paddingTop: '66.6666%',
width: '100%',
paddingTop: '56.25%',
},
}, },
})); }));
Project.defaultProps = { Project.defaultProps = {
reverse: false,
title: '', title: '',
description: '', description: '',
technologies: [], technologies: [],
@ -145,7 +135,6 @@ Project.defaultProps = {
}; };
Project.propTypes = { Project.propTypes = {
reverse: PropTypes.bool.isRequired,
title: PropTypes.string.isRequired, title: PropTypes.string.isRequired,
description: PropTypes.string.isRequired, description: PropTypes.string.isRequired,
technologies: PropTypes.arrayOf(PropTypes.string).isRequired, technologies: PropTypes.arrayOf(PropTypes.string).isRequired,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 KiB

After

Width:  |  Height:  |  Size: 751 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 413 KiB