diff --git a/src/pages/blog/components/_hero.js b/src/pages/blog/components/_hero.js index d5b2e81477d..21a666fbca0 100644 --- a/src/pages/blog/components/_hero.js +++ b/src/pages/blog/components/_hero.js @@ -4,7 +4,6 @@ import styled from 'styled-components' import { TextWrapper, Title } from './_common' import device from 'themes/device.js' import { Flex } from 'components/containers' -import { QueryImage } from 'components/elements' const MainWrapper = styled.div` width: 100%; @@ -51,6 +50,9 @@ const Wrapper = styled(Flex)` @media screen and (min-width: 1980px) { max-width: 1900px; } + @media screen and (max-width: 500px) { + padding: 2rem 4rem; + } ` const Hero = ({ heroImage, title, description }) => ( @@ -75,9 +77,7 @@ const Hero = ({ heroImage, title, description }) => ( {description} - - - + {heroImage} ) diff --git a/src/pages/blog/index.js b/src/pages/blog/index.js index 11ff82a40a8..e3603f7157f 100644 --- a/src/pages/blog/index.js +++ b/src/pages/blog/index.js @@ -1,5 +1,6 @@ import React from 'react' -import { graphql, useStaticQuery } from 'gatsby' +import PropTypes from 'prop-types' +import { graphql } from 'gatsby' import styled from 'styled-components' import Subscribe from './components/_subscribe' import RecentFeaturedPosts from './_recent-featured-posts' @@ -7,29 +8,36 @@ import DVideoBanner from './video-banner' import Hero from './components/_hero' import Layout from 'components/layout/layout' import { Container, SEO, Flex } from 'components/containers' -import { localize, WithIntl } from 'components/localization' -import { Carousel } from 'components/elements' +import { localize, WithIntl, LocalizedLink } from 'components/localization' +import { Carousel, QueryImage } from 'components/elements' -const query = graphql` - query { - hero_image_one: file(relativePath: { eq: "blog/blog-bg1.png" }) { - ...fadeIn - } - hero_image_two: file(relativePath: { eq: "blog/blog-bg2.png" }) { - ...fadeIn - } - hero_image_three: file(relativePath: { eq: "blog/blog-bg3.png" }) { - ...fadeIn - } - } -` const MainWrapper = styled(Flex)` background-color: var(--color-white); flex-direction: column; overflow: hidden; ` +export const query = graphql` + query MyQuery { + directus { + homepage_banners(filter: { status: { _eq: "published" } }) { + id + link + heading + sub_heading + image { + imageFile { + childImageSharp { + gatsbyImageData + } + } + id + } + } + } + } +` -const DerivBlog = () => { +const DerivBlog = ({ data }) => { const settings = { options: { loop: true, @@ -46,33 +54,37 @@ const DerivBlog = () => { nav_color: '--color-grey-5', }, } - const data = useStaticQuery(query) + const homepage_banner_data = data.directus.homepage_banners return ( - + - - - - + + {homepage_banner_data.map((page_data) => { + return ( + + + } + title={page_data.heading} + description={page_data.sub_heading} + /> + + ) + })} @@ -86,4 +98,8 @@ const DerivBlog = () => { ) } +DerivBlog.propTypes = { + data: PropTypes.object, +} + export default WithIntl()(DerivBlog)