Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import React, { Component } from "react"
  2. import { graphql } from "gatsby"
  3. import FilmList from '../components/films/filmList.js';
  4. import CharacterList from '../components/characters/characterList.js';
  5.  
  6. // This query is executed at build time by Gatsby.
  7. export const GatsbyQuery = graphql`
  8. {
  9. swapi {
  10. allFilms{
  11. id,
  12. title,
  13. releaseDate,
  14. openingCrawl,
  15. episodeId,
  16. director
  17. },
  18. allPersons{
  19. id,
  20. name,
  21. homeworld{
  22. name
  23. },
  24. species {
  25. name
  26. },
  27. birthYear,
  28. height,
  29. eyeColor,
  30. starships {
  31. name
  32. }
  33. },
  34. }
  35. }`
  36.  
  37.  
  38. class StarWarsApp extends Component {
  39. render() {
  40. const {swapi: { allFilms, allPersons }} = this.props.data;
  41.  
  42. return (
  43. <div className="star-wars-app">
  44. <div className="stars"></div>
  45. <div className="twinkling"></div>
  46. <div className="content">
  47.   <h2 className="section__title">Films</h2>
  48.   <FilmList films={allFilms} />
  49.  
  50.   <h2 className="section__title">Characters</h2>
  51.   <CharacterList characters={allPersons} />
  52. </div>
  53. </div>
  54. )
  55. }
  56. }
  57.  
  58. export default StarWarsApp;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement