dfghgfhplkjbv

src/templates/News.js

Mar 1st, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. import React, { Component } from 'react'
  2. import { graphql } from 'gatsby'
  3. import Layout from 'src/components/Layout'
  4. import Footer from 'src/components/Footer'
  5. import Cover from 'src/components/Cover'
  6. import News from 'src/components/News'
  7. import SubscribeMain from 'src/components/Subscribe'
  8. import PageHelmet from 'src/components/PageHelmet'
  9. import withLocale from 'src/components/withLocale'
  10.  
  11. class NewsTemplate extends Component {
  12. render() {
  13. const {
  14. locale,
  15. data: { news, subscribe },
  16. location: { pathname },
  17. changeLocale,
  18. } = this.props
  19.  
  20. return (
  21. <Layout locale={locale}>
  22. <PageHelmet title={news.title} image={news.image.id} description={news.description} locale={locale} />
  23. <Cover
  24. locale={locale}
  25. image={news.image}
  26. description={news.description}
  27. title={news.title}
  28. changeLocale={changeLocale}
  29. />
  30. <News news={news} locale={locale} pathname={pathname} />
  31. <SubscribeMain locale={locale} subscribe={subscribe} />
  32. <Footer locale={locale} />
  33. </Layout>
  34. )
  35. }
  36. }
  37.  
  38. export const query = graphql`
  39. query NewsTemplate($id: String!, $locale: String!) {
  40. news: datoCmsNews(id: { eq: $id }, locale: { eq: $locale }) {
  41. title
  42. image {
  43. id
  44. url
  45. fluid(maxWidth: 2560, imgixParams: { fm: "jpg", auto: "compress, format" }) {
  46. ...GatsbyDatoCmsFluid
  47. }
  48. }
  49. description
  50. author
  51. publishdate(formatString: "DD.MM.YYYY")
  52. slug
  53. bodyNode {
  54. childMarkdownRemark {
  55. html
  56. }
  57. }
  58. }
  59. subscribe: file(relativePath: { eq: "subscribe-illustration.jpeg" }) {
  60. childImageSharp {
  61. fluid(maxWidth: 1440) {
  62. ...GatsbyImageSharpFluid
  63. }
  64. }
  65. }
  66. }
  67. `
  68.  
  69. export default withLocale(NewsTemplate)
Add Comment
Please, Sign In to add comment