From b1600adec47a04f60e1da07d94a3ed3906ff5aee Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 14 Jun 2018 16:44:21 -0400 Subject: starter files --- frontend/components/Items.js | 74 -------------------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 frontend/components/Items.js (limited to 'frontend/components/Items.js') diff --git a/frontend/components/Items.js b/frontend/components/Items.js deleted file mode 100644 index 5694d0b..0000000 --- a/frontend/components/Items.js +++ /dev/null @@ -1,74 +0,0 @@ -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 ( -
- - - {({ data, error, loading }) => { - if (loading) { - return ( - - {Array.from({ length: 4 }) - .map((x, id) => ({ id })) - .map(x => )} - - ); - } - if (error) return
Error
; - return {data.items.map(item => )}; - }} -
- -
- ); - } -} - -export default ItemList; -export { ALL_ITEMS_QUERY }; -- cgit v1.3