aboutsummaryrefslogtreecommitdiff
path: root/src/components/Feed
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-08-09 16:09:21 +0300
committereug-vs <eug-vs@keemail.me>2020-08-09 16:09:21 +0300
commit236062c6c6278c4b433463fef9fa37eebf3fd760 (patch)
treed4451a7a9d0e29cac7c2ea91b1648f7450bbfc6b /src/components/Feed
parent70d20b76f042a519e8e164279dfa31b5ce027d44 (diff)
downloadwhich-ui-236062c6c6278c4b433463fef9fa37eebf3fd760.tar.gz
feat: lazy-load pages
Diffstat (limited to 'src/components/Feed')
-rw-r--r--src/components/Feed/Feed.tsx20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/components/Feed/Feed.tsx b/src/components/Feed/Feed.tsx
index 03358da..9918a3d 100644
--- a/src/components/Feed/Feed.tsx
+++ b/src/components/Feed/Feed.tsx
@@ -1,9 +1,8 @@
import React from 'react';
import { Poll } from 'which-types';
import { WindowScroller, AutoSizer, List } from 'react-virtualized';
-import CircularProgress from '@material-ui/core/CircularProgress';
-import { makeStyles } from '@material-ui/core';
import PollCard from '../PollCard/PollCard';
+import Loading from '../Loading/Loading';
interface PropTypes {
polls: Poll[];
@@ -15,17 +14,8 @@ interface RenderPropTypes {
style: React.CSSProperties;
}
-const useStyles = makeStyles(theme => ({
- loader: {
- width: '100%',
- textAlign: 'center',
- marginTop: theme.spacing(10)
- }
-}));
const Feed: React.FC<PropTypes> = ({ polls }) => {
- const classes = useStyles();
-
const RenderItem: React.FC<RenderPropTypes> = ({ index, style, key }) => {
const poll = polls[index];
@@ -36,12 +26,6 @@ const Feed: React.FC<PropTypes> = ({ polls }) => {
);
};
- const loader = (
- <div className={classes.loader}>
- <CircularProgress color="primary" style={{ margin: '0 auto' }} />
- </div>
- );
-
const list = (
<WindowScroller>
{({
@@ -74,7 +58,7 @@ const Feed: React.FC<PropTypes> = ({ polls }) => {
</WindowScroller>
);
- return polls.length ? list : loader;
+ return polls.length ? list : <Loading />;
};
export default Feed;