node-ejs-renderer/views/layouts/master.ejs
2024-06-09 13:55:01 -04:00

108 lines
2.7 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= title %></title>
<link rel="stylesheet" href="/css/styles.css">
<style>
/* General Styles */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
transition: background-color 0.3s, color 0.3s;
}
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
header {
background: #333;
color: #fff;
padding: 1em 0;
text-align: center;
}
nav ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;
justify-content: center;
gap: 1em;
}
nav ul li {
display: inline;
}
nav ul li a {
text-decoration: none;
color: #fff;
padding: 0.5em 1em;
border-radius: 5px;
transition: background 0.3s, color 0.3s;
}
nav ul li a:hover {
background: #555;
color: #fff;
}
button#darkModeToggle {
background: #555;
color: #fff;
border: none;
padding: 0.5em 1em;
cursor: pointer;
border-radius: 5px;
transition: background 0.3s, color 0.3s;
}
button#darkModeToggle:hover {
background: #777;
}
/* Responsive Design */
@media (max-width: 600px) {
nav ul {
flex-direction: column;
align-items: center;
}
nav ul li {
margin-bottom: 0.5em;
}
}
</style>
</head>
<body>
<header>
<h1><%= title %></h1>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/register">Register</a></li>
<li><a href="/login">Login</a></li>
<li><a href="/portfolio">Portfolio</a></li>
<li><a href="/about">About</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</nav>
<% if (session && session.data && session.data.user) { %>
<p>Welcome, <%= session.data.user.username %> (<%= session.data.user.role %>)</p>
<% } else { %>
<p>Welcome, Guest</p>
<% } %>
<button id="darkModeToggle">Toggle Dark Mode</button>
</header>
<main>
<%- include(`../${template}`, { session: session }) %>
</main>
<script src="/js/bundle.js"></script>
</body>
</html>