color scheme and visual style improved

This commit is contained in:
2022-02-06 12:48:52 -06:00
parent a5e5886925
commit 88594840b6
5 changed files with 62 additions and 21 deletions

View File

@@ -23,11 +23,13 @@
align-items: center; align-items: center;
margin: 0; margin: 0;
padding: 0; padding: 0;
overflow-y: hidden;
} }
.loading-message { .loading-message {
color:rgb(111, 30, 151); color:white;
font-family: 'Indie Flower', sans-serif; font-family: 'Indie Flower', sans-serif;
font-size: 2.5rem;
height: 100vh; height: 100vh;
} }
@@ -138,6 +140,8 @@
width: 90vw; width: 90vw;
} }
/* Page handling */
.page-handling { .page-handling {
display: inline-flex; display: inline-flex;
flex-direction: row; flex-direction: row;
@@ -175,9 +179,7 @@
} }
#bottom-page-handling { #bottom-page-handling {
margin-top: 5rem; margin-bottom: 10rem;
position: relative;
bottom: 6rem;
} }
/* Media queries (tablet) */ /* Media queries (tablet) */

View File

@@ -55,13 +55,14 @@ export default function Discussion({permalink, isVisible}) {
console.log(comment.data.replies.data.children[0].data.author) console.log(comment.data.replies.data.children[0].data.author)
return ( return (
<> <div className={comment.data.replies.data.children ? `indiv-comment nested` : "indiv-comment"}>
<p>THIS IS A REPLY:</p> <p className="comment-author">
<p>Nested {comment.data.replies.data.children[0].data.depth} layers deep</p> u/{comment.data.replies.data.children[0].data.author}
<p>{comment.data.replies.data.children[0].data.is_submitter ? 'OP posted' : ''}</p> {comment.data.replies.data.children[0].data.is_submitter ? ' (OP)' : ''}
<p>u/{comment.data.replies.data.children[0].data.author}</p> {comment.data.replies.data.children ? ' replied:' : ''}
<p>{comment.data.replies.data.children[0].data.body}</p> </p>
</> <p className="comment-body">{comment.data.replies.data.children[0].data.body}</p>
</div>
) )
} else { } else {
return; return;
@@ -72,11 +73,13 @@ export default function Discussion({permalink, isVisible}) {
setThread(comments.map((comment) => { setThread(comments.map((comment) => {
return ( return (
<>
<div className="indiv-comment" key={v4()}> <div className="indiv-comment" key={v4()}>
<p>u/{comment.data.author}</p> <p>u/{comment.data.author}</p>
<p>{comment.data.body}</p> <p>{comment.data.body}</p>
{getReplies(comment)}
</div> </div>
{getReplies(comment)}
</>
) )
})) }))
} }

View File

@@ -82,6 +82,8 @@ export default function Feed() {
let sortedPosts = extractedPosts.sort(comparePosts); // implements sorting function let sortedPosts = extractedPosts.sort(comparePosts); // implements sorting function
console.log(sortedPosts);
let newFeed = sortedPosts.map((post) => { let newFeed = sortedPosts.map((post) => {
return ( return (
<Post <Post

View File

@@ -76,6 +76,10 @@ img, video {
background-color: #064486; background-color: #064486;
} }
.crosspost-from {
color:rgb(228, 180, 226);
}
/* Handles comment styles on toggle */ /* Handles comment styles on toggle */
.comments-visible { .comments-visible {
@@ -88,6 +92,23 @@ img, video {
display: none; display: none;
} }
/* Comment styling */
.indiv-comment {
background-color: #7196be;
border-radius: 15px;
}
.nested {
position: relative;
width: calc(100% - 2.5rem);
left: 2.5rem;
}
.indiv-comment p {
padding: 1rem;
}
/* Queries */ /* Queries */
@media only screen and (max-width: 1050px) { /* for tablets */ @media only screen and (max-width: 1050px) { /* for tablets */

View File

@@ -14,7 +14,11 @@ export default function Post({data, key}) {
let media = data.post_hint === 'image' && data.url; let media = data.post_hint === 'image' && data.url;
let permalink = data.permalink; let permalink = data.permalink;
let selftext = data.selftext; let selftext = data.selftext;
let video = data.is_video ? data.media.reddit_video.fallback_url : null; // to do: handle media edge cases, especially video let video = data.is_video ? `${data.url}/DASH_1080.mp4` : null; // to do: handle media edge cases, especially video
// fallback_url: "https://v.redd.it/0rditq5l49g81/DASH_1080.mp4?source=fallback"
// url: "https://v.redd.it/0rditq5l49g81"
// id: "sm2wym"
const limit = 300; const limit = 300;
const [body, setBody] = useState(selftext); const [body, setBody] = useState(selftext);
@@ -71,10 +75,17 @@ export default function Post({data, key}) {
if (data.crosspost_parent_list[0].is_video) { if (data.crosspost_parent_list[0].is_video) {
return ( return (
<> <>
<video src={data.crosspost_parent_list[0].url}>This video is not supported by your browser.</video> <video controls src={data.crosspost_parent_list[0].media.reddit_video.fallback_url}>This video is not supported by your browser.</video>
<p>Crosspost from {data.crosspost_parent_list[0].subreddit_name_prefixed}</p> <p className="crosspost-from">Crosspost from {data.crosspost_parent_list[0].subreddit_name_prefixed}</p>
</> </>
); );
} else if (data.crosspost_parent_list[0].url && !data.url) {
return (
<>
<img alt={title} src={data.crosspost_parent_list[0].url} />
<p className="crosspost-from">Crosspost from {data.crosspost_parent_list[0].subreddit_name_prefixed}</p>
</>
)
} else { } else {
return; return;
} }
@@ -90,18 +101,20 @@ export default function Post({data, key}) {
{media ? <img alt={title} src={media} /> : ''} {media ? <img alt={title} src={media} /> : ''}
{data.crosspost_parent_list ? handleCrosspost() : ''} {data.crosspost_parent_list ? handleCrosspost() : ''}
{data.crosspost_parent_list ?
(data.crosspost_parent_list[0].is_video ?
<video src={data.crosspost_parent_list[0].url}></video>
: null)
: null}
{data.gallery_data ? {data.gallery_data ?
<p>View the gallery of photos corresponding to this post <a href={data.url}>here</a>.</p> <p>View the gallery of photos corresponding to this post <a href={data.url}>here</a>.</p>
: null} : null}
{video ? {video ?
<video controls type="video/mp4" src={video}></video> <video
controls
poster={data.thumbnail}
preload="auto"
src={video}>
Your video is not supported by the browser.
</video>
: ''} : ''}
{body ? {body ?