Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react'
- import { graphql } from 'gatsby'
- import Layout from 'src/components/Layout'
- import LayoutHelmet from 'src/components/LayoutHelmet'
- import Hot from 'src/components/Hot'
- import NewsFeed from 'src/components/NewsFeed'
- import SubscribeMain from 'src/components/Subscribe'
- import Footer from 'src/components/Footer'
- import Home from 'src/components/Home'
- import Jobs from 'src/components/Jobs'
- import withLocale from 'src/components/withLocale'
- class HomeTemplate extends Component {
- render() {
- const {
- data: {
- news: { edges: newsEdges },
- interviews: { edges: interviewsEdges },
- jobTags: { edges: jobTags },
- offers: { edges: offers },
- subscribe,
- },
- locale,
- changeLocale,
- } = this.props
- const prepareNews = (news) => news.filter(({ node }) => node.slug !== '_')
- const news = prepareNews(newsEdges)
- return (
- <Layout locale={locale}>
- <LayoutHelmet locale={locale} />
- <main>
- <Hot article={interviewsEdges[0]} locale={locale} changeLocale={() => changeLocale()} />
- <NewsFeed news={news} locale={locale} />
- <Home onChangeData={this.props.onChangeData} locale={locale} news={news} interviews={interviewsEdges} />
- <Jobs jobTags={jobTags} offers={offers} locale={locale} />
- <SubscribeMain locale={locale} subscribe={subscribe} />
- </main>
- <Footer locale={locale} />
- </Layout>
- )
- }
- }
- export const query = graphql`
- query HomePage($locale: String!) {
- interviews: allDatoCmsInterview(filter: { locale: { eq: $locale } }) {
- edges {
- node {
- title
- description
- author
- photographer
- publishDate
- image {
- url
- fluid(maxWidth: 1240, imgixParams: { fm: "jpg", auto: "compress, format" }) {
- ...GatsbyDatoCmsFluid
- }
- }
- podcast {
- podcastTitle
- podcastGuest
- podcastCover {
- id
- fluid(maxWidth: 400, imgixParams: { fm: "jpg", auto: "compress, format" }) {
- ...GatsbyDatoCmsFluid
- }
- }
- duration
- podcast {
- url
- }
- }
- summary {
- title
- description
- }
- bodyNode {
- childMarkdownRemark {
- html
- }
- }
- slug
- }
- }
- }
- news: allDatoCmsNews(
- filter: { ismain: { eq: true }, locale: { eq: $locale } }
- sort: { fields: [publishdate], order: DESC }
- limit: 3
- ) {
- edges {
- node {
- publishdate(formatString: "DD.MM.YYYY")
- slug
- title
- description
- ismain
- image {
- id
- fluid(maxWidth: 1240, imgixParams: { fm: "jpg", auto: "compress, format" }) {
- ...GatsbyDatoCmsFluid
- }
- }
- author
- }
- }
- }
- jobTags: allDatoCmsJobTag(filter: { locale: { eq: $locale } }) {
- edges {
- node {
- title
- locale
- id
- }
- }
- }
- offers: allDatoCmsJob(filter: { locale: { eq: $locale } }) {
- edges {
- node {
- locale
- id
- description
- companyName
- companyLogo {
- url
- }
- tag {
- id
- title
- }
- slug
- }
- }
- }
- subscribe: file(relativePath: { eq: "subscribe-illustration.jpeg" }) {
- childImageSharp {
- fluid(maxWidth: 1440) {
- ...GatsbyImageSharpFluid
- }
- }
- }
- }
- `
- export default withLocale(HomeTemplate)
Add Comment
Please, Sign In to add comment