1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-22 17:23:50 +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 { .postImage {
@include breakoutviewport();
max-width: none;
display: block; display: block;
margin-top: $spacer * 1.5;
margin-bottom: $spacer * 1.5;
a & { a & {
position: relative; position: relative;

View File

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

View File

@ -2,25 +2,33 @@
@import 'mixins'; @import 'mixins';
.photos { .photos {
@include breakoutviewport; @include breakoutviewport--full;
display: flex; display: grid;
flex-wrap: wrap; grid-template-columns: 1fr 1fr;
justify-content: space-between; gap: $spacer;
padding-left: $spacer; padding-left: $spacer;
padding-right: $spacer; padding-right: $spacer;
@media (min-width: $screen-md) { @media (min-width: $screen-sm) {
padding-left: 0; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
padding-right: 0;
} }
} }
.photo { .photo {
flex: 0 0 48%;
margin-bottom: 4%;
a { a {
display: block; 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 React from 'react'
import { graphql, Link } from 'gatsby' 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 { FluidObject } from 'gatsby-image'
import Page from '../templates/Page'
import PostImage from '../components/Post/PostImage'
import styles from './photos.module.scss'
const page = { const page = {
frontmatter: { frontmatter: {
@ -34,7 +33,11 @@ const PhotoThumbs = ({ edges }: { edges: PhotoNode[] }) =>
<article className={styles.photo} key={node.id}> <article className={styles.photo} key={node.id}>
{image && ( {image && (
<Link to={slug}> <Link to={slug}>
<Image fluid={image.childImageSharp.fluid} alt={title} /> <PostImage
title={title}
fluid={image.childImageSharp.fluid}
alt={title}
/>
</Link> </Link>
)} )}
</article> </article>

View File

@ -6,7 +6,21 @@
padding-top: $spacer; padding-top: $spacer;
padding-bottom: $spacer * 3; padding-bottom: $spacer * 3;
> a {
display: block;
}
&:only-child { &:only-child {
padding-bottom: $spacer; 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 === 'post' && <PostLead post={post} />}
{type === 'photo' && <PostContent post={post} />} {type === 'photo' && <PostContent post={post} />}
{image && ( {image && (
<div className={styles.postImageWrap}>
<PostImage fluid={image.childImageSharp.fluid} alt={title} /> <PostImage fluid={image.childImageSharp.fluid} alt={title} />
</div>
)} )}
{image && image.fields && <Exif exif={image.fields.exif} />} {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 Pagination from '../components/molecules/Pagination'
import Featured from '../components/molecules/Featured' import Featured from '../components/molecules/Featured'
import styles from './Posts.module.scss' import styles from './Posts.module.scss'
import stylesPost from './Post.module.scss'
export default function Posts({ export default function Posts({
data, data,
@ -36,11 +37,13 @@ export default function Posts({
{image && ( {image && (
<Link to={slug} title={title}> <Link to={slug} title={title}>
<div className={stylesPost.postImageWrap}>
<PostImage <PostImage
title={type === 'photo' ? title : null} title={type === 'photo' ? title : null}
fluid={image.childImageSharp.fluid} fluid={image.childImageSharp.fluid}
alt={title} alt={title}
/> />
</div>
</Link> </Link>
)} )}