diff --git a/src/features/posts/Feed.js b/src/features/posts/Feed.js index 4fb7432..1cd54c7 100644 --- a/src/features/posts/Feed.js +++ b/src/features/posts/Feed.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from "react"; -import postsSlice, { fetchBySub, updatePosts, selectPosts } from "./postsSlice"; +import { fetchBySub } from "./postsSlice"; import { selectAllSubs } from "../reddit/redditSlice"; import { useSelector, useDispatch } from "react-redux"; import { v4 } from "uuid"; @@ -8,6 +8,8 @@ import Post from "./Post"; export default function Feed() { const [feed, setFeed] = useState(null); const dispatch = useDispatch(); + + const subs = useSelector(selectAllSubs); useEffect(() => { let isActive = true; diff --git a/src/features/posts/Post.css b/src/features/posts/Post.css index 7577f35..5d29457 100644 --- a/src/features/posts/Post.css +++ b/src/features/posts/Post.css @@ -27,4 +27,8 @@ img, video { display: inline-flex; flex-direction: row; justify-content: space-between; +} + +.post-text { + font-size: 1.2rem; } \ No newline at end of file diff --git a/src/features/posts/Post.js b/src/features/posts/Post.js index c866081..f3eebe5 100644 --- a/src/features/posts/Post.js +++ b/src/features/posts/Post.js @@ -11,15 +11,23 @@ export default function Post({title,author,subreddit,ups,comments,time,key,media } else { return; } - }) + }, [setBody, selftext]); + + const handleHover = () => { + setBody(selftext); + } + + const handleMouseOut = () => { + setBody(selftext.substring(0,limit) + '...'); + } return ( <> -
{body}
+{body}
{author ? 'u/' + author : 'u/username'}
{time ? time : ''}
diff --git a/src/features/posts/postsSlice.js b/src/features/posts/postsSlice.js index 7c491a8..2ef0e54 100644 --- a/src/features/posts/postsSlice.js +++ b/src/features/posts/postsSlice.js @@ -7,7 +7,7 @@ export const fetchBySub = createAsyncThunk( const myRequest = new Request(subreddit); // initializes request let response = await fetch(myRequest); let json = await response.json(); - let postsArray = json.data.children; // unpacks individual post objects from the subreddit JSON file, as an array + let postsArray = json.data.children; // unpacks individual post objects from the subreddit JSON response, as an array return postsArray; } catch(e) { console.log(e);