1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2025-01-03 10:25:00 +01:00

project image & layout tweaks

This commit is contained in:
Matthias Kretschmann 2021-03-13 15:48:58 +01:00
parent 60cf22e924
commit 10e5927e8e
Signed by: m
GPG Key ID: 606EEEF3C479A91F
17 changed files with 77 additions and 114 deletions

View File

@ -23,3 +23,4 @@
- matthiaskretschmann.com - matthiaskretschmann.com
- beta.matthiaskretschmann.com - beta.matthiaskretschmann.com
- localhost - localhost
- 05.local

View File

@ -20,16 +20,6 @@
"network": "GitHub", "network": "GitHub",
"username": "kremalicious", "username": "kremalicious",
"url": "https://github.com/kremalicious" "url": "https://github.com/kremalicious"
},
{
"network": "Dribbble",
"username": "kremalicious",
"url": "https://dribbble.com/kremalicious"
},
{
"network": "Keybase",
"username": "kremalicious",
"url": "https://keybase.io/kremalicious"
} }
], ],
"location": { "location": {

View File

@ -1,7 +1,18 @@
.screen { .screen {
margin-top: calc(var(--spacer) * var(--line-height)); margin: calc(var(--spacer) * var(--line-height)) auto 0 auto;
padding-left: 2%;
padding-right: 2%;
} }
@media (min-width: 55rem) {
.screen {
padding-left: 4%;
padding-right: 4%;
max-width: calc(var(--projectImageMaxWidth) + 8%);
}
}
/* Single Project Page */
.screen > article { .screen > article {
display: grid; display: grid;
grid-template-columns: grid-template-columns:

View File

@ -1,13 +1,13 @@
.button { .button {
display: block; display: block;
width: 100%; width: 100%;
color: var(--brand-cyan); color: var(--link-color);
text-align: center; text-align: center;
border-radius: var(--border-radius); border-radius: var(--border-radius);
padding: calc(var(--spacer) / 4) calc(var(--spacer) / 2); padding: calc(var(--spacer) / 4) calc(var(--spacer) / 2);
transition-property: all; transition-property: all;
background: var(--box-background-color); background: var(--box-background-color);
border: 0.05rem solid var(--brand-cyan); border: var(--stroke-width) solid rgba(255, 255, 255, 0.2);
font-size: var(--font-size-small); font-size: var(--font-size-small);
text-transform: uppercase; text-transform: uppercase;
cursor: pointer; cursor: pointer;
@ -23,15 +23,14 @@
.button svg { .button svg {
margin-right: calc(var(--spacer) / 4); margin-right: calc(var(--spacer) / 4);
transition: 0.2s var(--easing); transition: 0.2s var(--easing);
margin-bottom: -0.1rem; margin-bottom: -0.15rem;
width: var(--font-size-small); width: var(--font-size-small);
height: var(--font-size-small); height: var(--font-size-small);
} }
.button:hover, .button:hover,
.button:focus { .button:focus {
color: #5ebeb1; border-color: var(--link-color);
border-color: #5ebeb1;
transform: translate3d(0, -0.1rem, 0); transform: translate3d(0, -0.1rem, 0);
box-shadow: var(--box-shadow); box-shadow: var(--box-shadow);
} }

View File

@ -1,11 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { fullWidth } from './FullWidth.module.css'
const FullWidth = ({ children }) => <div className={fullWidth}>{children}</div>
FullWidth.propTypes = {
children: PropTypes.node
}
export default FullWidth

View File

@ -1,3 +1,8 @@
.fullWidth { .fullContainer {
grid-column: full !important; grid-column: full !important;
} }
.fullWidth {
margin-left: calc(50% - 50vw);
margin-right: calc(50% - 50vw);
}

View File

@ -4,20 +4,22 @@ import { graphql } from 'gatsby'
import { GatsbyImage } from 'gatsby-plugin-image' import { GatsbyImage } from 'gatsby-plugin-image'
import { projectImage as styleProjectImage } from './ProjectImage.module.css' import { projectImage as styleProjectImage } from './ProjectImage.module.css'
export default function ProjectImage({ image, alt }) { export default function ProjectImage({ image, alt, className }) {
return ( return (
<GatsbyImage <GatsbyImage
className={styleProjectImage} className={`${styleProjectImage} ${className || ''}`}
backgroundColor="transparent" backgroundColor="transparent"
image={image} image={image}
alt={alt} alt={alt}
as="figure"
/> />
) )
} }
ProjectImage.propTypes = { ProjectImage.propTypes = {
image: PropTypes.object.isRequired, image: PropTypes.object.isRequired,
alt: PropTypes.string.isRequired alt: PropTypes.string.isRequired,
className: PropTypes.string
} }
export const projectImage = graphql` export const projectImage = graphql`
@ -28,6 +30,6 @@ export const projectImage = graphql`
export const projectImageTeaser = graphql` export const projectImageTeaser = graphql`
fragment ProjectImageTeaser on ImageSharp { fragment ProjectImageTeaser on ImageSharp {
gatsbyImageData(layout: CONSTRAINED, width: 980, quality: 85) gatsbyImageData(layout: CONSTRAINED, width: 740, quality: 85)
} }
` `

View File

@ -6,19 +6,22 @@
box-shadow: var(--box-shadow); box-shadow: var(--box-shadow);
} }
a:hover .frame,
a:focus .frame {
border-color: var(--link-color);
}
.projectImage { .projectImage {
composes: frame; composes: frame;
margin-left: auto;
margin-right: auto;
display: block; display: block;
} }
.projectImage:not(:only-of-type) {
margin-bottom: calc(var(--spacer) * 3);
}
@media (min-width: 1200px) { @media (min-width: 1200px) {
.projectImage { .projectImage:not(:only-of-type) {
max-width: var(--projectImageMaxWidth); margin-bottom: calc(var(--spacer) * 6);
} }
} }
.projectImage img {
display: block;
}

View File

@ -17,7 +17,7 @@
} }
.projectLinks svg { .projectLinks svg {
stroke: var(--text-color-light); stroke: var(--text-color);
width: var(--font-size-small); width: var(--font-size-small);
height: var(--font-size-small); height: var(--font-size-small);
margin-left: -1.2rem; margin-left: -1.2rem;

View File

@ -1,4 +1,5 @@
.projectNav { .projectNav {
composes: fullWidth from '../atoms/FullWidth.module.css';
white-space: nowrap; white-space: nowrap;
overflow-y: hidden; overflow-y: hidden;
overflow-x: auto; overflow-x: auto;

View File

@ -14,7 +14,6 @@
background: var(--box-background-color); background: var(--box-background-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
border: 0.05rem solid transparent; border: 0.05rem solid transparent;
color: var(--text-color-light);
font-size: var(--font-size-small); font-size: var(--font-size-small);
} }

View File

@ -2,7 +2,6 @@
padding: var(--spacer); padding: var(--spacer);
padding-top: calc(var(--spacer) * 4); padding-top: calc(var(--spacer) * 4);
text-align: center; text-align: center;
color: var(--text-color-light);
} }
.footer, .footer,
@ -22,9 +21,9 @@
margin-left: calc(var(--spacer) / 2); margin-left: calc(var(--spacer) / 2);
margin-right: calc(var(--spacer) / 2); margin-right: calc(var(--spacer) / 2);
margin-bottom: calc(var(--spacer) / 2); margin-bottom: calc(var(--spacer) / 2);
color: var(--text-color-light);
}
.copyright a {
color: inherit; color: inherit;
} }
.copyright {
color: var(--text-color-light);
}

View File

@ -38,21 +38,19 @@ function Project({ node, images }) {
const imageCount = getImageCount(images, slug) const imageCount = getImageCount(images, slug)
return ( return (
<article className={styleProject} key={slug}> <Link to={slug} className={styleProject} key={slug}>
<Link to={slug}> <h1 className={styleTitle}>{title}</h1>
<h1 className={styleTitle}>{title}</h1> <ProjectImage image={img.childImageSharp.gatsbyImageData} alt={title} />
<ProjectImage image={img.childImageSharp.gatsbyImageData} alt={title} />
{imageCount > 1 && ( {imageCount > 1 && (
<small <small
className={styleImageCount} className={styleImageCount}
title={`${imageCount} project images`} title={`${imageCount} project images`}
> >
<Icon name="Image" /> {imageCount} <Icon name="Image" /> {imageCount}
</small> </small>
)} )}
</Link> </Link>
</article>
) )
} }

View File

@ -1,14 +1,10 @@
.projects { .projects {
display: grid; display: grid;
grid-template-columns: 1fr; gap: calc(var(--spacer) * 2);
gap: calc(var(--spacer) * 3); grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
max-width: calc(var(--projectImageMaxWidth) + var(--spacer) * 2);
margin: 0 auto;
padding-left: var(--spacer);
padding-right: var(--spacer);
} }
@media (min-width: 30rem) { @media (min-width: 55rem) {
.projects { .projects {
grid-template-columns: repeat(auto-fit, minmax(25rem, 1fr)); grid-template-columns: repeat(auto-fit, minmax(25rem, 1fr));
} }
@ -24,41 +20,20 @@
z-index: 2; z-index: 2;
padding: calc(var(--spacer) / 3) var(--spacer); padding: calc(var(--spacer) / 3) var(--spacer);
color: #fff !important; color: #fff !important;
background: var(--brand-cyan); background: var(--link-color);
transform: translate3d(0, -1rem, 0); transform: translate3d(0, -1rem, 0);
transition: transform 0.2s ease-out; transition: transform 0.2s ease-out;
} }
.project { .project {
position: relative;
}
.project a {
display: block; display: block;
position: relative; position: relative;
} }
.project a::after { .project:hover .title,
content: ''; .project:focus .title,
position: absolute; .project:hover .imageCount,
left: 0; .project:focus .imageCount {
right: 0;
top: 0;
bottom: 0;
z-index: 1;
background: transparent;
transition: background 0.2s ease-out;
}
.project a:hover::after,
.project a:focus::after {
background: rgba(var(--brand-cyan), 0.05);
}
.project a:hover .title,
.project a:focus .title,
.project a:hover .imageCount,
.project a:focus .imageCount {
opacity: 1; opacity: 1;
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0);
} }

View File

@ -1,7 +1,7 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { graphql } from 'gatsby' import { graphql } from 'gatsby'
import FullWidth from '../components/atoms/FullWidth' import { fullContainer } from '../components/atoms/FullWidth.module.css'
import ProjectImage from '../components/atoms/ProjectImage' import ProjectImage from '../components/atoms/ProjectImage'
import ProjectTechstack from '../components/molecules/ProjectTechstack' import ProjectTechstack from '../components/molecules/ProjectTechstack'
import ProjectLinks from '../components/molecules/ProjectLinks' import ProjectLinks from '../components/molecules/ProjectLinks'
@ -9,7 +9,6 @@ import ProjectNav from '../components/molecules/ProjectNav'
import SEO from '../components/atoms/SEO' import SEO from '../components/atoms/SEO'
import { import {
meta, meta,
imageWrap,
headerTitle, headerTitle,
description description
} from './{ProjectsYaml.slug}.module.css' } from './{ProjectsYaml.slug}.module.css'
@ -29,15 +28,14 @@ ProjectMeta.propTypes = {
} }
function ProjectImages({ projectImages, title }) { function ProjectImages({ projectImages, title }) {
return ( return projectImages.map(({ node }) => (
<FullWidth> <ProjectImage
{projectImages.map(({ node }) => ( image={node.gatsbyImageData}
<div className={imageWrap} key={node.id}> alt={title}
<ProjectImage image={node.gatsbyImageData} alt={title} /> key={node.id}
</div> className={fullContainer}
))} />
</FullWidth> ))
)
} }
ProjectImages.propTypes = { ProjectImages.propTypes = {

View File

@ -1,16 +1,8 @@
.imageWrap {
margin-bottom: calc(var(--spacer) * 3);
}
.headerTitle { .headerTitle {
font-size: var(--font-size-h2); font-size: var(--font-size-h2);
} }
@media (min-width: 30em) { @media (min-width: 30em) {
.imageWrap {
margin-bottom: calc(var(--spacer) * 6);
}
.headerTitle { .headerTitle {
font-size: var(--font-size-h1); font-size: var(--font-size-h1);
} }

View File

@ -92,7 +92,8 @@ a:focus {
/* Media */ /* Media */
img, img,
video, video,
svg { svg,
figure {
max-width: 100%; max-width: 100%;
height: auto; height: auto;
margin: 0; margin: 0;