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.

31 lines
845 B

  1. import React, { Component } from 'react';
  2. import { Query } from 'react-apollo';
  3. import Background from '../../common/Background';
  4. import StoryMenu from './StoryMenu';
  5. import storyRootQuery from "./gql/StoryRoot";
  6. import { LoadingScreen } from '../../common/LoadingScreen';
  7. export class StoryIndex extends Component {
  8. render() {
  9. const categories = this.props.categoryType.enumValues.map(ev => ev.name).sort()
  10. return (
  11. <div className="StoryIndex theme-story">
  12. <Background />
  13. <StoryMenu categories={categories} />
  14. </div>
  15. )
  16. }
  17. }
  18. export default () => (
  19. <Query query={storyRootQuery}>
  20. {({ loading, error, data }) => {
  21. if (loading) return <LoadingScreen className="theme-story" />;
  22. if (error) return `Error! ${error.message}`;
  23. return <StoryIndex {...data} />
  24. }}
  25. </Query>
  26. );