From c7f2999ee797ea5e3bfb29517a4f13206162cc6f Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sun, 14 Jun 2020 19:52:35 +0300
Subject: refactor: use lowercase in folder names

---
 src/components/Feed/Feed.tsx | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 src/components/Feed/Feed.tsx

(limited to 'src/components/Feed/Feed.tsx')

diff --git a/src/components/Feed/Feed.tsx b/src/components/Feed/Feed.tsx
new file mode 100644
index 0000000..604c167
--- /dev/null
+++ b/src/components/Feed/Feed.tsx
@@ -0,0 +1,41 @@
+import React, { useState, useEffect } from 'react';
+import { makeStyles } from '@material-ui/core/styles';
+import { Poll } from '../../types';
+import PollCard from '../PollCard/PollCard';
+import { get } from '../../requests';
+
+interface PropTypes {
+  page: string;
+}
+
+const useStyles = makeStyles(theme => ({
+  root: {
+    position: 'relative',
+    maxWidth: theme.spacing(75),
+    margin: '0 auto'
+  }
+}));
+
+const Feed: React.FC<PropTypes> = ({ page }) => {
+  const [polls, setPolls] = useState<Poll[]>([]);
+  const classes = useStyles();
+
+  let endpoint = '/polls';
+  // TODO: Make this work
+  if (page === 'feed') endpoint = '/polls';
+
+  useEffect(() => {
+    get(endpoint).then(response => {
+      setPolls(response.data);
+    });
+  }, [endpoint]);
+
+  return (
+    <div className={classes.root}>
+      {polls.map(poll => <PollCard poll={poll} key={poll._id} />)}
+    </div>
+  );
+};
+
+export default Feed;
+
-- 
cgit v1.2.3


From 61a424debfbfa98570e070fbf25d03aa9c56d679 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sun, 14 Jun 2020 20:39:16 +0300
Subject: refactor: structurize pages

---
 src/components/Feed/Feed.tsx | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

(limited to 'src/components/Feed/Feed.tsx')

diff --git a/src/components/Feed/Feed.tsx b/src/components/Feed/Feed.tsx
index 604c167..8dc3ec1 100644
--- a/src/components/Feed/Feed.tsx
+++ b/src/components/Feed/Feed.tsx
@@ -1,11 +1,10 @@
-import React, { useState, useEffect } from 'react';
+import React from 'react';
 import { makeStyles } from '@material-ui/core/styles';
 import { Poll } from '../../types';
 import PollCard from '../PollCard/PollCard';
-import { get } from '../../requests';
 
 interface PropTypes {
-  page: string;
+  polls: Poll[];
 }
 
 const useStyles = makeStyles(theme => ({
@@ -16,20 +15,9 @@ const useStyles = makeStyles(theme => ({
   }
 }));
 
-const Feed: React.FC<PropTypes> = ({ page }) => {
-  const [polls, setPolls] = useState<Poll[]>([]);
+const Feed: React.FC<PropTypes> = ({ polls }) => {
   const classes = useStyles();
 
-  let endpoint = '/polls';
-  // TODO: Make this work
-  if (page === 'feed') endpoint = '/polls';
-
-  useEffect(() => {
-    get(endpoint).then(response => {
-      setPolls(response.data);
-    });
-  }, [endpoint]);
-
   return (
     <div className={classes.root}>
       {polls.map(poll => <PollCard poll={poll} key={poll._id} />)}
-- 
cgit v1.2.3

