<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Welcome to freedom wall, post a message here anonymously!">
    <title>Freedom Wall | Post a message anonymously!</title>
    <link rel="stylesheet" href="styles.css">
    <link href="https://cdn.jsdelivr.net/npm/remixicon@2.2.0/fonts/remixicon.css" rel="stylesheet">
</head>
<body>
	<style>
@import url('https://fonts.googleapis.com/css2?family=Nerko+One&family=Poppins:wght@300&display=swap');
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    background-color: #ffffff;
}
.center {
    display: flex;
    justify-content: center;
    align-items: center;
}
.nav {
    position: fixed;
    top: 0;
    height: 3rem;
    width: 100%;
    background-color: #ffffff;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
}
.nav h1 {
    margin: 0.4rem 1rem;
    color: #8083ff;
    font-family: 'Nerko One', cursive;
}
.nav .btn_menu {
    position: absolute;
    top: 0;
    right: 0;
    color: #BAC3CD;
    font-size: 24px;
    margin: 0.8rem 1rem;
}
.nav .btn_menu_opened {
    position: absolute;
    top: 0;
    right: 0;
    color: #8083ff;
    font-size: 24px;
    margin: 0.8rem 1rem;
    display: none;
}
.menu {
    position: fixed;
    top: 0;
    background-color: #ffffff;
    height: 13rem;
    width: 10rem;
    box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
    border-radius: 0 0 12px 0;
    text-align: center;
    display: none;
}
.menu h3 {
    text-align: left;
    margin: 0.5rem 0.5rem;
    font-size: 24px;
    margin-bottom: 1rem;
    color: #8083ff;
    font-family: 'Nerko One', cursive;
}
.menu ul li {
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 0.3rem;
    margin-top: 0.3remrem;
}
.menu ul li a {
    text-decoration: none;
    color: #BAC3CD;
    transition: 0.5s;
    font-family: 'Poppins', sans-serif;
}
.menu ul li a:hover {
    color: #8083ff;
}

.messages {
    margin-top: 5rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    margin-bottom: 5rem;
}
.messages .message-card {
    background-color: #ffffff;
    box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
    margin-top: 3rem;
    width: 90%;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    
}
.messages .message-card p {
    color: #8083ff;
    padding: 1.5rem 1.5rem;
    font-family: 'Nerko One', cursive;
}

</style>
    <div class="nav">
        <h1>Freedom Wall</h1>
        <i class="ri-menu-3-line btn_menu"></i>
        <i class="ri-menu-2-line btn_menu_opened"></i>
    </div>
    <div class="menu">
        <h3>Menu</h3>
        <ul>
            <li><a href="/">Home</a></li>
            <li><a href="/feed">Feed</a></li>
            <li><a href="https://github.com/libyzxy0">Github</a></li>
        </ul>
    </div>
    <div class="center">
        <div class="messages" id="messages-container"></div>
    </div>
    
    <script>
var btnMenu = document.querySelector(".btn_menu");
var btnMenuOpened = document.querySelector(".btn_menu_opened");
var menu = document.querySelector(".menu");
btnMenu.addEventListener("click", function() {
   btnMenu.style.display="none"
  btnMenuOpened.style.display="block";
  menu.style.display="block"; 
});  
btnMenuOpened.addEventListener("click", function() {
  btnMenu.style.display="block"
  btnMenuOpened.style.display="none";
  menu.style.display="none";
});

let messagesArray = <%-JSON.stringify(messages) %>

function createMessage(que) {
    let messagesContainer = document.getElementById("messages-container");
    var messageCard = document.createElement("div");
    messageCard.classList="message-card";
    messagesContainer.appendChild(messageCard);
    var text = document.createElement("p");
    text.innerHTML=que;
    messageCard.appendChild(text);
}
for(let i = 0;i < messagesArray.length;i++) {
    createMessage(messagesArray[i])
}


</script>
</body>
</html>
