GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
799 B

  1. import React, { Component } from "react"
  2. import { Query } from "react-apollo"
  3. import { LoadingScreen } from "../../common/LoadingScreen"
  4. import Main from "../../common/Main"
  5. import storyListQuery from "./gql/StoryList";
  6. export class StoryList extends Component {
  7. render() {
  8. const { stories } = this.props
  9. return (
  10. <Main className="StoryList">
  11. { stories.map(s => <h1>{s.name}</h1>) }
  12. </Main>
  13. )
  14. }
  15. }
  16. export default ({filter}) => (
  17. <Query query={storyListQuery} variables={{filter}}>
  18. {({ loading, error, data }) => {
  19. if (loading) {
  20. return <LoadingScreen className="theme-story" />
  21. }
  22. if (error) {
  23. return `Error! ${error.message}`
  24. }
  25. console.log(filter);
  26. return <StoryList {...data} />
  27. }}
  28. </Query>
  29. )