Separate layout for portrait hero images
This commit is contained in:
parent
afbb9754e2
commit
c7f25ca856
0
src/components/Index/HeroImage.js
Normal file
0
src/components/Index/HeroImage.js
Normal file
@ -6,8 +6,8 @@ import { take } from 'ramda';
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import posthog from 'posthog-js';
|
import posthog from 'posthog-js';
|
||||||
|
|
||||||
import { getVibrantToHelmetSafeBodyStyle, getVibrant } from '../utils';
|
import { getVibrantToHelmetSafeBodyStyle, getVibrant, getAspectRatio } from '../utils';
|
||||||
import { HeroA } from '../components/IndexComponents';
|
import { HeroA } from '../components/Index/HeroLink';
|
||||||
|
|
||||||
// TODO: better text colors in situations of low contrast
|
// TODO: better text colors in situations of low contrast
|
||||||
|
|
||||||
@ -81,6 +81,7 @@ const IndexPage = ({ data: { allFile: { edges } } }) => {
|
|||||||
}, [imageIndex, images.length]);
|
}, [imageIndex, images.length]);
|
||||||
|
|
||||||
const vibrant = getVibrant(image);
|
const vibrant = getVibrant(image);
|
||||||
|
const ar = getAspectRatio(image);
|
||||||
return (<>
|
return (<>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<title>Chuck Dries</title>
|
<title>Chuck Dries</title>
|
||||||
@ -90,13 +91,13 @@ const IndexPage = ({ data: { allFile: { edges } } }) => {
|
|||||||
/>
|
/>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
<main
|
<main
|
||||||
className="font-serif block md:grid hero"
|
className={classnames('font-serif hero', ar > 1 ? 'flex md:grid flex-col' : 'grid md:flex md:flex-row-reverse')}
|
||||||
>
|
>
|
||||||
{isClient ?
|
{isClient ?
|
||||||
<GatsbyImage
|
<GatsbyImage
|
||||||
alt=""
|
alt=""
|
||||||
className={classnames(
|
className={classnames(
|
||||||
'md:h-screen h-two-thirds-vw',
|
ar > 1 ? 'md:h-screen h-two-thirds-vw' : 'h-screen w-full md:w-1/2',
|
||||||
)}
|
)}
|
||||||
image={getImage(image)}
|
image={getImage(image)}
|
||||||
loading="eager"
|
loading="eager"
|
||||||
@ -176,8 +177,8 @@ export const query = graphql`
|
|||||||
filter: {
|
filter: {
|
||||||
sourceInstanceName: {eq: "gallery"},
|
sourceInstanceName: {eq: "gallery"},
|
||||||
# images that don't work well
|
# images that don't work well
|
||||||
base: {nin: ["DSC06517.jpg"]}
|
# base: {nin: ["DSC06517.jpg"]}
|
||||||
childrenImageSharp: {elemMatch: {fluid: {aspectRatio: {gte: 1.4}}}}
|
# childrenImageSharp: {elemMatch: {fluid: {aspectRatio: {lte: 1.3}}}}
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
edges {
|
edges {
|
||||||
@ -185,6 +186,9 @@ export const query = graphql`
|
|||||||
relativePath
|
relativePath
|
||||||
base
|
base
|
||||||
childImageSharp {
|
childImageSharp {
|
||||||
|
fluid {
|
||||||
|
aspectRatio
|
||||||
|
}
|
||||||
gatsbyImageData(
|
gatsbyImageData(
|
||||||
layout: FULL_WIDTH
|
layout: FULL_WIDTH
|
||||||
placeholder: NONE
|
placeholder: NONE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user