[] TopNav 관련 로직 추가 및 변경

1. 모바일에서 화면에 제대로 그려지지 않는 오류 수정
2. 화살표 그림 icon으로 직접 이미지 추가
3. 드롭다운 활성화시 뒷 배경 누르면 드롭다운 사라지는 기능 추가
This commit is contained in:
SEAN-59 2025-06-24 17:55:26 +09:00
parent 250aac4b29
commit c04152dac8
7 changed files with 21 additions and 11 deletions

View File

@ -13,7 +13,7 @@
<LeftSideAcademy/>
</div>
<div class="flex flex-1 flex-col md:ml-64">
<div class="fixed top-0 right-0 left-64 z-10">
<div class="fixed top-0 right-0 md:left-64 left-0 z-10">
<TopNavAcademy/>
</div>
<div class="flex-1 mt-16">

View File

@ -16,7 +16,9 @@ public partial class MainLayout : LayoutComponentBase, IDisposable
// 경로의 시작 부분
// protected bool isHidePrjTop => Navigation.ToBaseRelativePath(Navigation.Uri).StartsWith("auth", StringComparison.OrdinalIgnoreCase);
protected bool isIntro => Navigation.ToBaseRelativePath(Navigation.Uri).StartsWith("am/intro", StringComparison.OrdinalIgnoreCase);
protected bool isIntro => Navigation.ToBaseRelativePath(Navigation.Uri).StartsWith("am/intro", StringComparison.OrdinalIgnoreCase)
|| Navigation.ToBaseRelativePath(Navigation.Uri).StartsWith("/", StringComparison.OrdinalIgnoreCase);
// 경로의 끝 부분
protected bool isHidePrjTop => Navigation.ToBaseRelativePath(Navigation.Uri).EndsWith("auth", StringComparison.OrdinalIgnoreCase);
protected bool isAcademy => Navigation.ToBaseRelativePath(Navigation.Uri).StartsWith("am", StringComparison.OrdinalIgnoreCase);
@ -24,8 +26,6 @@ public partial class MainLayout : LayoutComponentBase, IDisposable
// 경로 일치
// protected bool isIntro => Navigation.ToBaseRelativePath(Navigation.Uri).Equals("am/intro", StringComparison.OrdinalIgnoreCase);
// protected override void OnInitialized()
protected override async Task OnInitializedAsync()
{
LoadingService.OnChange += StateHasChanged;

View File

@ -1,11 +1,10 @@
<div class="flex items-center justify-between whitespace-nowrap border-b border-solid border-b-[#f0f2f5] h-[72px] w-full bg-white">
<div class="flex items-center justify-between whitespace-nowrap border-b border-solid border-b-[#f0f2f5] h-[72px] w-full bg-white px-4">
<div id="AcademyDrop" class="relative flex items-center gap-4 text-[#111418] flex-1">
<button class="flex items-center gap-2 hover:text-blue-600" @onclick="ToggleAcademyDropdown">
<h2 class="hidden md:block text-text-title text-lg font-bold leading-tight tracking-[-0.015em]">AcaMate</h2>
<svg class="w-4 h-4 transition-transform duration-200 @(isAcademyDropdownOpen ? "rotate-180" : "")"
fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
</svg>
<img src="Resources/Images/Icon/Down.png" alt="아래"
class="w-6 h-6 object-cover transition-transform duration-200 @(isAcademyDropdownOpen ? "rotate-180" : "")" />
</button>
@if (isAcademyDropdownOpen)
@ -26,7 +25,12 @@
}
</div>
<div class="hidden md:flex flex-1 justify-end gap-8 mr-4">
@if (isAcademyDropdownOpen)
{
<div @onclick="OnClickOutside" class="fixed inset-0 z-40" style="background: transparent;"></div>
}
<div class="hidden md:flex flex-1 justify-end gap-8">
<div class="flex flex-1 justify-end gap-8">
<div class="flex items-center gap-6">
<img src="Resources/Images/Icon/Notification_SET.png" alt="알림" class="w-6 h-6 object-cover" />

View File

@ -24,4 +24,10 @@ public partial class TopNavAcademy : ComponentBase
protected void ToggleAcademyDropdown() {
isAcademyDropdownOpen = !isAcademyDropdownOpen;
}
private void OnClickOutside()
{
if (isAcademyDropdownOpen) isAcademyDropdownOpen = false;
StateHasChanged();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

File diff suppressed because one or more lines are too long