Skip to content

Commit

Permalink
feat : menu add 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellol77 committed Jul 29, 2024
1 parent f37cfd5 commit 655adf7
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 deletions.
3 changes: 0 additions & 3 deletions frontend/src/assets/menu.svg

This file was deleted.

File renamed without changes.
Empty file.
32 changes: 21 additions & 11 deletions frontend/src/controller/menuController.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,35 @@ export default class MenuController {

this.socket.on("getBubbles", (bubbles) => {
bubbles.map((bubble) => {
const div = document.createElement("li");
const li = document.createElement("li");
li.classList.add("menu_li");
const span = document.createElement("span");
const p = document.createElement("p");
span.textContent = timeAgo(new Date(bubble.created_at));
span.classList.add("text_createAt");
p.textContent = bubble.text;
div.classList.add("menu_bubble");
div.id = bubble.id;
div.appendChild(p);
div.appendChild(span);
this.menuOl.appendChild(div);
p.classList.add("text_small");
li.classList.add("menu_bubble");
li.id = bubble.id;
li.appendChild(p);
li.appendChild(span);
this.menuOl.appendChild(li);
});
});

this.socket.on("add", (data) => {
const div = document.createElement("div");
div.textContent = data.text;
div.id = data.id;
div.classList.add("menu_bubble");
this.menuOl.appendChild(div);
const li = document.createElement("li");
li.id = data.id;
li.classList.add("menu_bubble");
const p = document.createElement("p");
p.classList.add("text_small");
p.textContent = data.text;
const span = document.createElement("span");
span.textContent = timeAgo(new Date(data.created_at));
span.classList.add("text_createAt");
li.appendChild(p);
li.appendChild(span);
this.menuOl.appendChild(li);
});

this.socket.on("delete", (id) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CanvasController from "./controller/canvasController";
import InputController from "./controller/inputController";
import Input from "./components/input";
import Menu from "./components/menu";
import Menu from "./components/menu/menu";
import MenuController from "./controller/menuController";

class App {
Expand Down
17 changes: 15 additions & 2 deletions frontend/src/styles/menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@
}
#menu_ol {
list-style: none;
padding: 24px;
padding-left: 24px;
margin-top: 100px;
height: 60%;
height: 70%;
background-color: #333;
overflow-y: scroll;
}

.menu_li {
margin-bottom: 8px;
}

.menu_bubble {
color: #fff;
font-size: 1.5rem;
Expand Down Expand Up @@ -79,3 +83,12 @@ footer {
font-size: 1rem;
font-family: "Dongle", sans-serif;
}

.text_small {
font-size: 1.8rem;
}

.text_createAt {
font-size: 1.2rem;
color: #ccc;
}

0 comments on commit 655adf7

Please sign in to comment.