dfghgfhplkjbv

src/templates/Video.js

Mar 5th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. import React, { Component } from 'react'
  2. import { graphql } from 'gatsby'
  3. import Layout from 'src/components/Layout'
  4. import LayoutHelmet from 'src/components/LayoutHelmet'
  5. import SubscribeMain from 'src/components/Subscribe'
  6. import Footer from 'src/components/Footer'
  7. import Home from 'src/components/Home'
  8. import Header from 'src/components/Header'
  9. import SingleVideo from 'src/components/SingleVideo'
  10. import NewsFeed from 'src/components/NewsFeed'
  11. import withLocale from 'src/components/withLocale'
  12.  
  13. class Video extends Component {
  14. render() {
  15. const {
  16. data: {
  17. news: { edges: newsEdges },
  18. video,
  19. subscribe,
  20. },
  21. locale,
  22. changeLocale,
  23. } = this.props
  24.  
  25. const news = newsEdges.filter(({ node }) => node.slug !== '_')
  26.  
  27. console.log(this.props)
  28.  
  29. return (
  30. <Layout locale={locale}>
  31. <LayoutHelmet locale={locale} />
  32. <main>
  33. <Header
  34. {...this.props}
  35. locale={locale}
  36. full={true}
  37. style={{ backgroundColor: '#161616' }}
  38. changeLocale={changeLocale}
  39. />
  40. <SingleVideo data={video} />
  41. <NewsFeed news={news} locale={locale} inversed />
  42. <Home onChangeData={this.props.onChangeData} locale={locale} />
  43. <SubscribeMain locale={locale} subscribe={subscribe} />
  44. </main>
  45. <Footer locale={locale} />
  46. </Layout>
  47. )
  48. }
  49. }
  50.  
  51. export const query = graphql`
  52. query($id: String!) {
  53. video: datoCmsSingleVideo(id: { eq: $id }) {
  54. title
  55. videoId
  56. }
  57. news: allDatoCmsNews(filter: { ismain: { eq: true } }, sort: { fields: [publishdate], order: DESC }, limit: 3) {
  58. edges {
  59. node {
  60. publishdate(formatString: "DD/MM/YYYY")
  61. slug
  62. title
  63. description
  64. ismain
  65. image {
  66. id
  67. fluid(maxWidth: 1240, imgixParams: { fm: "jpg", auto: "compress, format" }) {
  68. ...GatsbyDatoCmsFluid
  69. }
  70. }
  71. author
  72. }
  73. }
  74. }
  75.  
  76. subscribe: file(relativePath: { eq: "subscribe-illustration.jpeg" }) {
  77. childImageSharp {
  78. fluid(maxWidth: 1440) {
  79. ...GatsbyImageSharpFluid
  80. }
  81. }
  82. }
  83. }
  84. `
  85.  
  86. export default withLocale(Video)
Advertisement
Add Comment
Please, Sign In to add comment