diff --git a/src/components/atoms/Image.jsx b/src/components/atoms/Image.jsx index 80686bc1..3db63015 100644 --- a/src/components/atoms/Image.jsx +++ b/src/components/atoms/Image.jsx @@ -18,10 +18,10 @@ const Image = ({ fluid, fixed, alt }) => ( Image.propTypes = { fluid: PropTypes.object, fixed: PropTypes.object, - alt: PropTypes.string + alt: PropTypes.string.isRequired } -export const projectImage = graphql` +export const imageSizeDefault = graphql` fragment ImageFluid on ImageSharp { fluid(maxWidth: 940, quality: 85) { ...GatsbyImageSharpFluid_withWebp_noBase64 diff --git a/src/components/atoms/Image.module.scss b/src/components/atoms/Image.module.scss index e39de2ae..f1062ffa 100644 --- a/src/components/atoms/Image.module.scss +++ b/src/components/atoms/Image.module.scss @@ -13,6 +13,7 @@ margin-left: auto; margin-right: auto; + margin-bottom: $spacer; display: block; @media (min-width: 940px) { @@ -20,4 +21,8 @@ border-radius: .25rem; overflow: hidden; } + + a:hover & { + border-color: $link-color !important; + } } diff --git a/src/components/atoms/PostImage.jsx b/src/components/atoms/PostImage.jsx new file mode 100644 index 00000000..4232c0d0 --- /dev/null +++ b/src/components/atoms/PostImage.jsx @@ -0,0 +1,26 @@ +import React from 'react' +import PropTypes from 'prop-types' +import Image from './Image' +import styles from './PostImage.module.scss' + +const PostImage = ({ title, fluid, fixed, alt }) => ( + +) + +PostImage.propTypes = { + fluid: PropTypes.object, + fixed: PropTypes.object, + alt: PropTypes.string.isRequired, + title: PropTypes.string +} + +export default PostImage diff --git a/src/components/atoms/PostImage.module.scss b/src/components/atoms/PostImage.module.scss new file mode 100644 index 00000000..4bd818f0 --- /dev/null +++ b/src/components/atoms/PostImage.module.scss @@ -0,0 +1,60 @@ +@import 'variables'; +@import 'mixins'; + +.postImageTitle { + transition: .1s ease-out; + font-size: $font-size-h3; + font-family: $font-family-headings; + line-height: $line-height-headings; + font-weight: $font-weight-headings; + letter-spacing: -.02em; + margin: 0; + position: absolute; + top: 10%; + padding: $spacer / 3 $spacer; + background: rgba($link-color, .85); + color: #fff; + text-shadow: 0 1px 0 #000; + left: 0; + opacity: 0; + transform: translate3d(0, -20px, 0); +} + +.postImage { + @include breakoutviewport(); + + max-width: none; + display: block; + margin-top: $spacer * 1.5; + margin-bottom: $spacer * 1.5; + + > div { + @include media-frame(); + + border-radius: 0; + + @media (min-width: $screen-sm) { + border-radius: $border-radius; + } + } + + a & { + position: relative; + display: block; + } + + a:hover & { + > div { + border-color: $link-color !important; + } + + .postImageTitle { + opacity: 1; + transform: translate3d(0, 0, 0); + } + } + + img { + border-radius: 0; + } +} diff --git a/src/pages/goodies.jsx b/src/pages/goodies.jsx index f45f0f9b..c59704cc 100644 --- a/src/pages/goodies.jsx +++ b/src/pages/goodies.jsx @@ -1,7 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import { graphql, Link } from 'gatsby' -import Image from '../components/atoms/Image' +import PostImage from '../components/atoms/PostImage' import Page from '../templates/Page' import styles from './goodies.module.scss' @@ -18,9 +18,7 @@ const Goodies = ({ data }) => { {image && (