From 8a5825d52271d712ec7c8348447d433067e13ef2 Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 13 Sep 2018 14:18:56 -0400 Subject: DONE --- .../frontend/components/Pagination.js | 76 ---------------------- 1 file changed, 76 deletions(-) delete mode 100644 finished-application/frontend/components/Pagination.js (limited to 'finished-application/frontend/components/Pagination.js') diff --git a/finished-application/frontend/components/Pagination.js b/finished-application/frontend/components/Pagination.js deleted file mode 100644 index f684840..0000000 --- a/finished-application/frontend/components/Pagination.js +++ /dev/null @@ -1,76 +0,0 @@ -import React from 'react'; -import { Query } from 'react-apollo'; -import styled from 'styled-components'; -import Link from 'next/link'; -import PropTypes from 'prop-types'; -import gql from 'graphql-tag'; -import Head from 'next/head'; -import { perPage } from '../config'; -import PaginationStyles from './styles/PaginationStyles'; - - - -const PAGINATION_QUERY = gql` - query itemsConnection($skip: Int = 0, $first: Int = 4) { - itemsConnection(orderBy: createdAt_DESC, first: $first, skip: $skip) { - aggregate { - count - } - } - } -`; - -const Pagination = props => ( - - {({ data, loading, error }) => { - if (loading || error) return null; - const { aggregate } = data.itemsConnection; - const { page } = props; - const pages = Math.ceil(aggregate.count / perPage); - return ( - - - - Sick Fits! — Page {page} of {pages} - - - - - ←Prev - - -

- Page {page} of {pages} -

-

- {aggregate.count} Items Total -

- - = pages}> - Next → - - -
- ); - }} -
-); - -Pagination.propTypes = { - page: PropTypes.number.isRequired, -}; - -export default Pagination; -export { PAGINATION_QUERY }; -- cgit v1.3