diff options
| author | Wes Bos <wesbos@gmail.com> | 2018-01-30 12:41:01 -0500 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2018-01-30 12:41:01 -0500 |
| commit | cd0b07b3adb36fb5ec098f9e511ab45d774fee7b (patch) | |
| tree | a203e5010219ccea1acc6bbd2c0a4bcfa0a78615 /components/Pagination.js | |
| parent | 0a1648bf47490b312169c531aeb51ef4725e8d2e (diff) | |
Move to Prisma Backend
Diffstat (limited to 'components/Pagination.js')
| -rw-r--r-- | components/Pagination.js | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/components/Pagination.js b/components/Pagination.js deleted file mode 100644 index dedd231..0000000 --- a/components/Pagination.js +++ /dev/null @@ -1,43 +0,0 @@ -import React, { Component } from 'react'; -import { graphql, gql, compose } from 'react-apollo'; -import { ALL_ITEMS_QUERY } from '../queries'; -import withData from '../lib/withData'; -import { Link } from '../routes'; - -const Pagination = props => { - const { loading, error } = props.allItemsQuery; - - if (loading) return <p>Loading Item...</p>; - - const meta = props.allItemsQuery._allItemsMeta; - const { page } = props; - const pages = Math.floor(meta.count / 3); - return ( - <div> - <p> - Page <strong>{page} </strong> - of - <strong>{pages} </strong> - - - <strong>{meta.count} </strong> - total - </p> - - {page > 1 ? ( - <Link prefetch route="items" params={{ page: page - 1 }}> - <a>←Prev</a> - </Link> - ) : null} - - {page < pages ? ( - <Link prefetch route="items" params={{ page: page + 1 }}> - <a>Next →</a> - </Link> - ) : null} - </div> - ); -}; - -const ComponentWithMutations = compose(graphql(ALL_ITEMS_QUERY, { name: 'allItemsQuery' }))(Pagination); - -export default ComponentWithMutations; |
