Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI enhancement #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions scripts/meet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ request.onreadystatechange = function () {
let newItem = document.createElement("div");
let container = createContainer();
newItem.className = "open-chat";
newItem.id = "open-chat";
newItem.innerText = "😄";
box.insertBefore(newItem, box.childNodes[0]);
box.insertBefore(container, box.childNodes[0]);
Expand Down Expand Up @@ -115,7 +116,15 @@ function createContainer() {
function createGrid() {
document
.getElementsByClassName("open-chat")[0]
.addEventListener("click", () => {
.addEventListener("click", (e) => {
const openChat = document.getElementById(e.target.id);

if (openChat.classList.contains("active")) {
openChat.classList.remove("active");
} else {
openChat.classList.add("active");
}

let cont = document.getElementById("emoji-container");

if (cont.style.display !== "none") {
Expand Down Expand Up @@ -154,12 +163,23 @@ function createGrid() {
let newElement = document.createElement("li");
newElement.innerHTML = emojis[Object.keys(emojis)[i]][0];
newElement.id = Object.keys(emojis)[i];
newElement.className = "em-nav";
newElement.classList.add("em-nav");
if (i === 0) {newElement.classList.add("active");}

document.getElementById("navbar").appendChild(newElement);

// re render with new emozi
newElement.addEventListener("click", (e) => {

const navs = [...document.getElementsByClassName("em-nav")];
navs.forEach(nav => {
if (nav.classList.contains("active")) {
nav.classList.remove("active")
} else if (nav.id === e.target.id) {
nav.classList.add("active")
}
});

document.getElementById("emoticon-div").innerHTML = "";

for (let i = 0; i < emojis[e.target.id].length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</head>
<body class="popup">
<div id="emoji-container" class="emoji-container-popup">
<ul id="navbar"></ul>
<div class="navbar-container"><ul id="navbar"></ul></div>
<div id="emoticon-div" class="emoticon-div"></div>
</div>
<script src="./popupScript.js" type="module" async defer></script>
Expand Down
14 changes: 13 additions & 1 deletion scripts/popup/popupScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,22 @@ for (let i = 0; i < Object.keys(emojis).length; i++) {
let newElement = document.createElement("li");
newElement.innerHTML = emojis[Object.keys(emojis)[i]][0];
newElement.id = Object.keys(emojis)[i];
newElement.className = "em-nav";
newElement.classList.add("em-nav");
if (i === 0) {newElement.classList.add("active");}

document.getElementById("navbar").appendChild(newElement);
newElement.addEventListener("click", (e) => {

const navs = [...document.getElementsByClassName("em-nav")];
navs.forEach(nav => {
if (nav.classList.contains("active")) {
nav.classList.remove("active")
}
else if (nav.id === e.target.id) {
nav.classList.add("active")
}
});

document.getElementById("emoticon-div").innerHTML = "";

for (let i = 0; i < emojis[e.target.id].length; i++) {
Expand Down
86 changes: 66 additions & 20 deletions scripts/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
height: 350px;
width: 270px;
border-radius: 2%;
background-color: antiquewhite;
padding: 10px;
border: 1px solid rgb(203, 205, 209);
background-color: white;
flex-wrap: wrap;
flex-basis: 100%;
position: absolute;
Expand All @@ -16,8 +16,10 @@
flex-direction: row;
flex-wrap: wrap;
overflow-y: scroll;
height: 80%;
padding: 7px;
height: calc(100% - 119px);
padding: 10px 15px;
width: auto;
margin: 0px auto;
}

.grid {
Expand All @@ -27,32 +29,50 @@
justify-content: center;
display: flex;
font-size: 22px;
cursor: pointer;
cursor: copy;
}

.navbar-container {
margin: 0px auto;
width: fit-content;
}

#navbar {
list-style-type: none;
box-sizing: border-box;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
padding: 3px;
background-color: rgb(241, 243, 244);
border-bottom: 1px solid rgb(203, 205, 209);
width: 100%;
overflow: auto;
display: flex;
justify-content: center;
flex-wrap: wrap;
}

.em-nav {
float: left;
padding: 0px 10px;
padding: 3px 4px 3px 8px;
display: block;
color: white;
box-sizing: border-box;
flex-grow: 0;
flex-shrink: 0;
text-align: center;
margin: 5px 0px;
margin: 3px;
text-decoration: none;
font-size: 17px;
border-radius: 12px;
border: 1px solid rgb(203, 205, 209);
background-color: rgb(241, 243, 244);
}

.em-nav.active {
border: 1px solid rgb(203, 205, 209);
background-color: rgb(203, 205, 209);
}

.em-nav:hover {
background-color: #111;
background-color: rgb(203, 205, 209);
cursor: pointer;
}

Expand All @@ -70,26 +90,52 @@
.open-chat {
font-size: 20px;
cursor: pointer;
border: 2px solid #909497;
border: 1px solid rgb(241, 243, 244);;
width: 30px;
height: 30px;
box-sizing: border-box;
padding: 0px 1px 3px 4px;
margin-left: 10px;
border-radius: 50%;
background-color: rgb(241, 243, 244);
}

.popup {
height: 338px;
width: 250px;
.open-chat:hover{
border: 1px solid rgb(203, 205, 209);
background-color: rgb(203, 205, 209);
}

background-color: antiquewhite;
padding: 10px;
.open-chat.active {
background-color: rgb(203, 205, 209);
}

.popup {
height: 338px;
width: 270px;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
margin: 0px;
}

.emoji-container-popup {
height: 350px;
width: 270px;
padding: 10px;
top: 0px;
position: absolute;
background-color: white;
border: none;
flex-wrap: wrap;
flex-basis: 100%;
flex-direction: row;
}

.emoji-container-popup .em-nav {
padding-right: 8px;
padding-bottom: 4px;
padding-top: 2px;
width: 35px;
height: 35px;
box-sizing: border-box;
}