summaryrefslogtreecommitdiffstats
path: root/frontend/components/Items.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-05-10 15:06:29 -0400
committerWes Bos <wesbos@gmail.com>2018-05-10 15:06:29 -0400
commite0c628528142f26ce9a42ba4c3c5d2cb41114a56 (patch)
tree902a7c32978efc4d94d945c50f9378db36040aa5 /frontend/components/Items.js
parentc832accab191190d93c470a622651b6ac6699ddd (diff)
migrate styles
Diffstat (limited to 'frontend/components/Items.js')
-rw-r--r--frontend/components/Items.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/frontend/components/Items.js b/frontend/components/Items.js
index 1289de1..9489f5d 100644
--- a/frontend/components/Items.js
+++ b/frontend/components/Items.js
@@ -4,6 +4,7 @@ import styled from 'styled-components';
import PropTypes from 'prop-types';
import Pagination from './Pagination';
import Item from './Item';
+import LoadingItem from './LoadingItem';
import { perPage } from '../config';
import { ALL_ITEMS_QUERY } from '../queries/queries';
@@ -43,7 +44,15 @@ class ItemList extends React.Component {
fetchPolicy={fetchPolicy}
>
{({ data, error, loading }) => {
- if (loading) return null;
+ if (loading) {
+ return (
+ <Items>
+ {Array.from({ length: 4 })
+ .map((x, id) => ({ id }))
+ .map(x => <LoadingItem key={x.id} />)}
+ </Items>
+ );
+ }
if (error) return <div>Error</div>;
return <Items>{data.items.map(item => <Item key={item.id} item={item} />)}</Items>;
}}