Skip to content

Commit

Permalink
fix: header nav 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jungeun0712 committed Dec 19, 2024
1 parent 30c997f commit 399691e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/page/home.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Header } from "../util/header.js";
import { Footer } from "../util/footer.js";

export const HomePage = (isLogin) => `
export const HomePage = () => `
<div class="bg-gray-100 min-h-screen flex justify-center">
<div class="max-w-md w-full">
${Header(isLogin)}
${Header()}
<main class="p-4">
<div class="mb-4 bg-white rounded-lg shadow p-4">
Expand Down
5 changes: 3 additions & 2 deletions src/util/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { State } from "../store/state";

export const Header = () => {
const currentPath = window.location.pathname;
const hashPath = window.location.hash;
const state = new State();
let isLogin = !!state.getState();
return `
Expand All @@ -11,10 +12,10 @@ export const Header = () => {
<nav class="bg-white shadow-md p-2 sticky top-14">
<ul class="flex justify-around">
<li><a href="/" class="${currentPath === "/" ? "text-blue-600 font-bold" : "text-gray-600"}">홈</a></li>
<li><a href="/" class="${currentPath === "/" || hashPath === "#/" ? "text-blue-600 font-bold" : "text-gray-600"}">홈</a></li>
${
isLogin
? `<li><a href="/profile" class="${currentPath === "/profile" ? "text-blue-600" : "text-gray-600"}">프로필</a></li>
? `<li><a href="/profile" class="${currentPath === "/profile" || hashPath === "#/profile" ? "text-blue-600" : "text-gray-600"}">프로필</a></li>
<li><a href="#" id="logout" class="text-gray-600">로그아웃</a></li>`
: `<li><a href="/login" id="login" class="text-gray-600">로그인</a></li>`
}
Expand Down

0 comments on commit 399691e

Please sign in to comment.