From 631be4a30b212fcf5b42fa31ed9409e70a63c0b1 Mon Sep 17 00:00:00 2001 From: meccacodes Date: Tue, 19 Nov 2024 16:19:18 -0800 Subject: [PATCH 1/6] Part 1 Finished --- README.md | 6 +----- index.html | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.js | 28 ++++++++++++++++++++++++++ style.css | 25 +++++++++++++++++++++++ 4 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 index.html create mode 100644 main.js create mode 100644 style.css diff --git a/README.md b/README.md index 20395898..912146dd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1 @@ -## Project Reddit - -This project has been created by a student at Parsity, an online software engineering course. The work in this repository is wholly of the student based on a sample starter project that can be accessed by looking at the repository that this project forks. - -If you have any questions about this project or the program in general, visit [parsity.io](https://parsity.io/) or email hello@parsity.io. +# ReReddit Eval diff --git a/index.html b/index.html new file mode 100644 index 00000000..dcda3817 --- /dev/null +++ b/index.html @@ -0,0 +1,58 @@ + + + + + + + + Forum + + +
+

Forum

+ +
+
+
+ + +
+
+ + +
+ +
+
+
+
+

+ +
+
+ + + + diff --git a/main.js b/main.js new file mode 100644 index 00000000..8e1d7ff2 --- /dev/null +++ b/main.js @@ -0,0 +1,28 @@ +const postsFeed = document.getElementById("posts-feed"); +const user = document.getElementById("user"); +const post = document.getElementById("post"); +const submitBtn = document.getElementById("post-btn"); +const username = document.getElementById("username"); +const postText = document.getElementById("postText"); + +let posts = []; + +const stringToHTML = function (str) { + let dom = document.createElement("div"); + dom.innerHTML = str; + return dom; +}; + +const getInputs = function () { + submitBtn.addEventListener("click", function () { + posts.push({ user: user.value, post: post.value }); + console.log(posts); + let latestPost = posts.length - 1; + console.log(posts[latestPost].user); + let postStr = `

${posts[latestPost].user}

${posts[latestPost].post}

`; + let postHTML = stringToHTML(postStr); + postsFeed.prepend(postHTML); + }); +}; + +getInputs(); diff --git a/style.css b/style.css new file mode 100644 index 00000000..3e5d93ae --- /dev/null +++ b/style.css @@ -0,0 +1,25 @@ +body { + background-color: #000; + color: #fff; +} + +h1, +h2 { + text-align: center; +} + +p { + font-size: 17px; +} + +.post-form { + width: 80%; +} + +.posts-feed { + width: 80%; +} + +.posts-container { + width: 80%; +} From 7da744d0794eb7e733b1ce42e9dd182c8d3e4726 Mon Sep 17 00:00:00 2001 From: meccacodes Date: Thu, 21 Nov 2024 15:44:24 -0800 Subject: [PATCH 2/6] posts can be deleted now, working on commenting functions --- README.md | 4 + index.html | 19 +---- main.js | 231 ++++++++++++++++++++++++++++++++++++++++++++++++++--- style.css | 43 +++++++++- 4 files changed, 270 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 912146dd..f8a787ac 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ # ReReddit Eval + +## Cohort 14 + +### Part Time diff --git a/index.html b/index.html index dcda3817..4bc0262e 100644 --- a/index.html +++ b/index.html @@ -15,17 +15,12 @@

Forum

-
+

Make a post

- +
@@ -38,15 +33,9 @@

Forum

-
+
-
-

- -
+