import React from 'react'; import { Query } from 'react-apollo'; import styled from 'styled-components'; import PropTypes from 'prop-types'; import gql from 'graphql-tag'; import Pagination from './Pagination'; import Item from './Item'; import LoadingItem from './LoadingItem'; import { perPage } from '../config'; const ALL_ITEMS_QUERY = gql` query ALL_ITEMS_QUERY($skip: Int = 0, $first: Int = ${perPage}) { items(orderBy: createdAt_DESC, first: $first, skip: $skip) { __typename id title price description image largeImage } } `; const Items = styled.div` display: grid; grid-template-columns: 1fr 1fr; grid-gap: 60px; max-width: ${props => props.theme.maxWidth}; margin: 0 auto; `; const Center = styled.div` text-align: center; `; class ItemList extends React.Component { static propTypes = { page: PropTypes.number.isRequired, }; render() { return (