1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-22 09:13:35 +01:00

new photos layout

This commit is contained in:
Matthias Kretschmann 2019-10-06 18:25:00 +02:00
parent 3f2b2516f3
commit 0a8b5eda9d
Signed by: m
GPG Key ID: 606EEEF3C479A91F
7 changed files with 62 additions and 36 deletions

View File

@ -23,12 +23,7 @@
}
.postImage {
@include breakoutviewport();
max-width: none;
display: block;
margin-top: $spacer * 1.5;
margin-bottom: $spacer * 1.5;
a & {
position: relative;

View File

@ -7,24 +7,25 @@ export const fadeIn = {
}
}
const transition = { type: 'spring' }
const enter = {
y: 0,
...transition
}
export const moveInTop = {
enter: {
y: 0,
transition: { type: 'spring' }
},
...enter,
exit: {
y: '-2rem',
transition: { type: 'spring' }
...transition
}
}
export const moveInBottom = {
enter: {
y: 0,
transition: { type: 'spring' }
},
...enter,
exit: {
y: '2rem',
transition: { type: 'spring' }
...transition
}
}

View File

@ -2,25 +2,33 @@
@import 'mixins';
.photos {
@include breakoutviewport;
@include breakoutviewport--full;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
display: grid;
grid-template-columns: 1fr 1fr;
gap: $spacer;
padding-left: $spacer;
padding-right: $spacer;
@media (min-width: $screen-md) {
padding-left: 0;
padding-right: 0;
@media (min-width: $screen-sm) {
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
}
.photo {
flex: 0 0 48%;
margin-bottom: 4%;
a {
display: block;
}
figure {
> div {
margin: 0;
}
}
figcaption {
font-size: $font-size-base;
padding-left: $spacer / 2;
padding-right: $spacer / 2;
}
}

View File

@ -1,10 +1,9 @@
import React from 'react'
import { graphql, Link } from 'gatsby'
import Image from '../components/atoms/Image'
import Page from '../templates/Page'
import styles from './photos.module.scss'
import { FluidObject } from 'gatsby-image'
import Page from '../templates/Page'
import PostImage from '../components/Post/PostImage'
import styles from './photos.module.scss'
const page = {
frontmatter: {
@ -34,7 +33,11 @@ const PhotoThumbs = ({ edges }: { edges: PhotoNode[] }) =>
<article className={styles.photo} key={node.id}>
{image && (
<Link to={slug}>
<Image fluid={image.childImageSharp.fluid} alt={title} />
<PostImage
title={title}
fluid={image.childImageSharp.fluid}
alt={title}
/>
</Link>
)}
</article>

View File

@ -6,7 +6,21 @@
padding-top: $spacer;
padding-bottom: $spacer * 3;
> a {
display: block;
}
&:only-child {
padding-bottom: $spacer;
}
}
.postImageWrap {
@include breakoutviewport();
figure {
max-width: none;
margin-top: $spacer * 1.5;
margin-bottom: 0;
}
}

View File

@ -39,7 +39,9 @@ export default function Post({
{type === 'post' && <PostLead post={post} />}
{type === 'photo' && <PostContent post={post} />}
{image && (
<PostImage fluid={image.childImageSharp.fluid} alt={title} />
<div className={styles.postImageWrap}>
<PostImage fluid={image.childImageSharp.fluid} alt={title} />
</div>
)}
{image && image.fields && <Exif exif={image.fields.exif} />}

View File

@ -11,6 +11,7 @@ import SEO from '../components/atoms/SEO'
import Pagination from '../components/molecules/Pagination'
import Featured from '../components/molecules/Featured'
import styles from './Posts.module.scss'
import stylesPost from './Post.module.scss'
export default function Posts({
data,
@ -36,11 +37,13 @@ export default function Posts({
{image && (
<Link to={slug} title={title}>
<PostImage
title={type === 'photo' ? title : null}
fluid={image.childImageSharp.fluid}
alt={title}
/>
<div className={stylesPost.postImageWrap}>
<PostImage
title={type === 'photo' ? title : null}
fluid={image.childImageSharp.fluid}
alt={title}
/>
</div>
</Link>
)}