IT/Java - Spring Boot
[Spring Boot] νμ΄μ§μ μ¬μ΄λ λ° μ½λ©νκΈ°
ITyranno
2023. 11. 1. 11:13
728x90
λ°μν
νλ‘κ·Έλλ° μΈκ³λ₯Ό νꡬν©μλ€.
Spring Bootλ₯Ό νμ©νμ¬ νμ΄μ§μ μ¬μ΄λ λ°λ₯Ό λνλΌ μ μμ΅λλ€.
μ€λ₯Έμͺ½μ λ²κ° λͺ¨μ μ΄λͺ¨ν°μ½μ λλ₯΄λ©΄ μ¬μ΄λλ°κ° μ¬λΌμ΄λ νμμΌλ‘ μ΄λ¦½λλ€. λ‘κ·ΈμΈ μ , νμ μμ±λλ νλͺ©μ΄ λ€λ₯΄λ©° νμ μμκ° μλ λͺ©λ‘μ λ§μ°μ€λ₯Ό μ¬λ Έμ λ μ¬μ΄λλ°κ° νλ λ μ΄λ¦¬λ©΄μ νμ νλͺ©μ΄ λνλ©λλ€. μ¬μ΄λ λ°μ μμ§μμ λ°λΌ λ²κ° λͺ¨μ μ΄λͺ¨ν°μ½λ ν¨κ» μμ§μ λλ€.
ꡬν νλ©΄
μμ± μ½λ
nav.html
<!DOCTYPE html>
<html>
<head>
</head>
<style>
body {
z-index: 100;
}
.menubar a {
text-decoration: none;
}
.container {
background: none;
}
.button {
font-size: 50px;
position: relative;
right: 80px;
top: 0px;
width: 40px;
height: 40px;
z-index: 99;
transition: 0.8s ease;
background: none;
border: none;
}
/* .x {
align-items: center;
color: black;
margin: auto;
} */
.content {
padding: 100px 20px 0 40px;
position: relative;
width: 200%;
}
.nav-1 {
display: flex;
}
.nav-2 {
height: 80%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-evenly;
}
.home {
display: flex;
align-items: center;
height: 22px;
}
.my_account {
margin-top: -15px;
display: flex;
align-items: center;
height: 32px;
border-radius: 100%;
}
@font-face {
font-family: 'Cafe24Ssurround';
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2105_2@1.0/Cafe24Ssurround.woff') format('woff');
font-weight: normal;
font-style: normal;
}
.word {
margin-left: 15px;
margin-top: -12px;
font-size: 25px;
font-family: 'Cafe24Ssurround';
color: black;
cursor: pointer;
}
@media (max-width: 768px) {
.sidebar {
right: -300px;
/* Move sidebar to the right */
}
.button {
right: 10px;
/* Move button to the right */
}
.content {
padding-right: 20px;
/* Adjust padding */
}
}
.menubar .submenu {
display: none;
}
.menubar {
position: relative;
}
.submenu {
display: none;
position: fixed;
top: 0;
right: 300px;
width: 300px;
height: 100%;
background-color: rgb(249, 227, 128);
padding-top: 11rem;
}
.sidebar {
background-color: rgb(237, 208, 77);
border-left: 2px solid rgb(237, 208, 77);
position: fixed;
top: 0;
bottom: 0;
right: 0;
transition: 0.4s ease;
color: #202020;
height: 100%;
z-index: 99;
}
</style>
<body>
<div class="container">
<div class="sidebar" style="width: 300px; height: 100%;">
<button class="button">β‘
</button>
<div class="content">
<!-- <nav class="nav">
<div class="nav-1">
<div class="head_logo">
<a href="/">
<img class="logo_text" src="car.png" alt="λ‘κ³ " />
</a>
</div>
</div> -->
<div class="nav-2">
<div class="menubar">
<a class="word" th:href="@{/}">ν</a>
</div>
<div class="menubar">
<a class="word" th:href="@{/map}">μΆ©μ μ μ°ΎκΈ°</a>
<!-- <div class="submenu">
<a class="word" th:href="@{/map}">μ§λ</a>
<a class="word" th:href="@{/map}">λͺ©λ‘ μΆκ°</a>
</div> -->
</div>
<div class="menubar">
<a class="word">κ²μν</a>
<div class="submenu">
<a class="word" th:href="@{/board/list}">곡μ§μ¬ν</a>
<a class="word" th:href="@{/qna/list}">Q&A</a>
</div>
</div>
<div class="menubar">
<a class="word">μ 보λ§λΉ</a>
<div class="submenu">
<a class="word" th:href="@{/statistic/chargerStatus}">ν΅κ³μ 보</a>
<a class="word" th:href="@{/statistic/ChargerExpense}">μλΉμ€μλ΄</a>
</div>
</div>
<div class="menubar">
<a class="word">λ―Έλμ΄</a>
<div class="submenu">
<a class="word" th:href="@{/media/news?searchText=μ κΈ°μ°¨}">μ κΈ°μ°¨ λ΄μ€</a>
<a class="word" th:href="@{/media/reels}">μ κΈ°μ°¨ μμ</a>
<a class="word" th:href="@{/media/gamepage}">μ κΈ°μ°¨ κ²μ</a>
</div>
</div>
<div class="menubar">
<a class="word">λ©€λ²μ</a>
<div class="submenu">
<a class="word" th:href="@{/exchange}">μ½μΈκ΅ν</a>
<a class="word" th:href="@{/coupon}">μΏ ν°ν¨</a>
<br>
<a class="word" th:href="@{/membership}">κ°μ
νκΈ°</a>
<a th:if="${session != null and session.user_info != null and session.has_membership}" class="word" th:href="@{/mymembership}">λμ λ©€λ²μ</a>
</div>
</div>
</div>
<br>
<br>
<div th:if="${session.user_info == null}" class="menubar">
<a th:href="@{/signin}" class="word">λ‘κ·ΈμΈ</a>
<a th:href="@{/signup}" class="word">νμκ°μ
</a>
</div>
<div th:unless="${session.user_info == null}" class="menubar">
<span class="word">[[ ${session.user_info.name} + 'λ λ°κ°μ΅λλ€.' ]]</span>
<br>
<a class="word" th:href="@{/exchange}">λμ μ°λ¦¬λ¦Ώ: <span th:text="${userCoin}"></span>κ°</a>
<br>
<a th:href="@{/mypage(email=${session.user_info.email})}" class="word">Mypage</a>
<br>
<!-- <a th:href="${session.user_info != null and session.user_info.role == 'ADMIN'}"></a> -->
<a th:if="${session != null and session.user_info != null and session.user_info.role == 'ADMIN'}" th:href="@{/admin}" class="word">
Admin
</a>
<br>
<a th:href="@{/signout}" class="word">λ‘κ·Έμμ</a>
</div>
</div>
</div>
</div>
</div>
</nav>
</div>
</div>
</div>
<script>
const button = document.querySelector(".button");
const sidebar = document.querySelector(".sidebar");
let isSidebarOpen = false;
let timeoutId;
sidebar.style.width = "0";
button.addEventListener("click", () => {
if (!isSidebarOpen) {
sidebar.style.width = "300px";
isSidebarOpen = true;
} else {
sidebar.style.width = "0";
button.style.right = "80px";
closeSubmenus();
isSidebarOpen = false;
}
});
function closeSubmenus() {
const submenus = document.querySelectorAll(".submenu");
submenus.forEach((submenu) => {
submenu.style.display = "none";
});
// If there's no submenu open, move the button back to right.
if (!document.querySelector('.submenu[style*="block"]')) {
button.style.right = "80px";
}
}
const menuItems = document.querySelectorAll(".menubar");
menuItems.forEach((menuItem) => {
menuItem.addEventListener("mouseover", () => {
if (isSidebarOpen) {
closeSubmenus();
const submenu = menuItem.querySelector(".submenu");
if (submenu) {
submenu.style.display = "block";
button.style.right = "310px"; // If a submenu opens, move the button right.
}
}
});
menuItem.addEventListener("mouseout", () => {
if (isSidebarOpen) {
const submenu = menuItem.querySelector(".submenu");
if (submenu && submenu.style.display === "block") {
timeoutId = setTimeout(() => {
submenu.style.display = "none";
if (!document.querySelector('.submenu[style*="block"]')) { // check if there's no other opened sub-menu
button.style.right = "80px"; // If a submenu closes, move the button back to right.
}
}, 1000); // wait for one second before closing the submenu
}
}
});
menuItem.addEventListener("mouseover", () => clearTimeout(timeoutId)); // if mouse comes back on item before timeout ends, clear the timeout
});
</script>
</body>
</html>
μμ κ°μ μ½λλ₯Ό μμ±νμ¬ μ¬μ΄λ λ°λ₯Ό ꡬμ±ν μ μμ΅λλ€.
728x90
λ°μν