diff --git a/README.md b/README.md
index 85741ca..11ced71 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,4 @@
infinite scrolling
https://webdesign.tutsplus.com/how-to-implement-infinite-scrolling-with-javascript--cms-37055t
+
+Icons from https://fontawesome.com/
diff --git a/icon/bookmark-regular.svg b/icon/bookmark-regular.svg
new file mode 100644
index 0000000..ea49a09
--- /dev/null
+++ b/icon/bookmark-regular.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/icon/retweet-solid.svg b/icon/retweet-solid.svg
new file mode 100644
index 0000000..049c9b7
--- /dev/null
+++ b/icon/retweet-solid.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/icon/star-regular.svg b/icon/star-regular.svg
new file mode 100644
index 0000000..ede81f2
--- /dev/null
+++ b/icon/star-regular.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/main.js b/main.js
index 8947efe..350d6d3 100644
--- a/main.js
+++ b/main.js
@@ -60,6 +60,8 @@ class Post {
this.replyTo = data.replyTo;
this.parentPost = null;
+ this.stars = 420;
+
this.replies = [];
}
@@ -113,6 +115,44 @@ class Post {
getContentElement() {
const elem = document.createElement("p");
elem.innerHTML = this.content;
+
+
+ return elem;
+ }
+
+ getIconElement(svg, right) {
+ const elem = document.createElement("div");
+ elem.className = "icon";
+ right *= 94;
+ elem.style.right = `${right}px`;
+
+ const imgElem = document.createElement("img");
+ imgElem.className = "icon-img";
+ imgElem.setAttribute("src", svg);
+ elem.appendChild(imgElem);
+
+ const countElem = document.createElement("span");
+ // TODO: make an icon class to store count OR i guess just parse it out of the DOM
+ countElem.className = "icon-count";
+ countElem.innerHTML = "42069";
+ elem.appendChild(countElem);
+
+ return elem;
+ }
+
+ getFooterElement() {
+ const elem = document.createElement("div");
+ elem.className = "post-footer";
+
+ const starIconElem = this.getIconElement("icon/star-regular.svg", 0);
+ elem.appendChild(starIconElem);
+
+ const repostElem = this.getIconElement("icon/retweet-solid.svg", 1)
+ elem.appendChild(repostElem);
+
+ const bookmarkElem = this.getIconElement("icon/bookmark-regular.svg", 2);
+ elem.appendChild(bookmarkElem);
+
return elem;
}
@@ -138,6 +178,7 @@ class Post {
elem.className = classes.join(" ");
elem.appendChild(this.getHeaderElement());
elem.appendChild(this.getContentElement());
+ elem.appendChild(this.getFooterElement());
elem.appendChild(this.getReplyButton());
for (let i = 0; i < this.replies.length; i++) {
diff --git a/styles.css b/styles.css
index 64865d3..a995676 100644
--- a/styles.css
+++ b/styles.css
@@ -2,6 +2,10 @@
--header-height: 64px;
--blue-gray: #374955;
--sky-blue: #86b1cc;
+ /* use filter: instead of color: to color SVGs
+ * https://isotropic.co/tool/hex-color-to-css-filter/ */
+ --blue-gray-filter: invert(27%) sepia(20%) saturate(575%) hue-rotate(161deg) brightness(93%) contrast(93%);
+ --sky-blue-filter: invert(73%) sepia(16%) saturate(657%) hue-rotate(160deg) brightness(90%) contrast(91%);
--comment-column-width: 3px;
}
@@ -154,6 +158,40 @@ body {
justify-content: left;
}
+.post-footer {
+ position: relative;
+}
+
+.icon {
+ color: var(--sky-blue);
+ height: 32px;
+ width: 100px;
+ position: absolute;
+ top: 16px;
+}
+
+.icon-img {
+ filter: var(--blue-gray-filter);
+ height: 32px;
+ width: 32px;
+ display: inline-block;
+}
+
+.icon-img.active {
+ filter: var(--sky-blue-filter)
+}
+
+.icon-count {
+ color: var(--blue-gray);
+ height: 100%;
+ display: flex;
+ align-items: center;
+ position: absolute;
+ top: 0;
+ left: 32px;
+ margin-left: 4px;
+}
+
.write-post {
cursor: pointer;
color: var(--blue-gray);