From 8b1ea4f4fa84dcb644b6d30a772fe60828cfb30f Mon Sep 17 00:00:00 2001 From: kangddong Date: Wed, 14 Jan 2026 23:33:51 +0900 Subject: [PATCH] =?UTF-8?q?feat(refactor):=20Header=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EB=B6=84=EB=A6=AC=20=EB=B0=8F=20=ED=86=B5?= =?UTF-8?q?=ED=95=A9=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Common/Sources/DesignSystem/HeaderBar.swift | 81 +++++++++++++++---- .../Presentation/Detail/CommunityDetail.swift | 2 +- .../Report/CommunityReportView.swift | 2 +- .../Write/CommunityWriteView.swift | 2 +- Hambug.xcodeproj/project.pbxproj | 1 + Home/Sources/Presentation/HomeView.swift | 8 +- Home/Sources/Presentation/SuggestView.swift | 2 +- .../Presentation/MyActivitiesView.swift | 2 +- .../MyPage/MyPage+LocalizedString.swift | 1 - .../Presentation/MyPage/MyPageView.swift | 17 ++-- 10 files changed, 81 insertions(+), 37 deletions(-) diff --git a/Common/Sources/DesignSystem/HeaderBar.swift b/Common/Sources/DesignSystem/HeaderBar.swift index 5845e61..29643ec 100644 --- a/Common/Sources/DesignSystem/HeaderBar.swift +++ b/Common/Sources/DesignSystem/HeaderBar.swift @@ -7,33 +7,82 @@ import SwiftUI +public enum HeaderType { + case home + case community + case myPage + + var displayText: String { + switch self { + case .home: + return "햄버그" + case .community: + return "커뮤니티" + case .myPage: + return "마이페이지" + } + } +} // 상단 헤더 - 로고, 알림 public struct HeaderBar: View { private let fontStyle: FontStyle - public init() { + private let type: HeaderType + + public init(type: HeaderType) { fontStyle = .init(.custom("GeekbleMalang2"), size: 24.0) + self.type = type } - public var body: some View { - HStack(spacing: 4) { - Image("hambug_icon") - .resizable() - .frame(width: 30, height: 30) + @ViewBuilder + var titleSection: some View { + switch type { + case .home: + HStack(spacing: 4) { + Image("hambug_icon") + .resizable() + .frame(width: 28, height: 26) + + Text(type.displayText) + .font(fontStyle.font) + .lineSpacing(fontStyle.lineHeight) + .foregroundColor(.primaryHambugRed) + } - Text("햄버그") - .font(fontStyle.font) - .lineSpacing(fontStyle.lineHeight) - .foregroundColor(.primaryHambugRed) + case .community, .myPage: + Text(type.displayText) +// .padding(.bottom, 15) + .pretendard(.title(.t2)) + .foregroundColor(type == .community ? .white : Color.textG900) + } + } + + @ViewBuilder + var notificationSection: some View { + switch type { + case .home, .community: + NavigationLink { + AlarmListView() + Text("asd") + } label: { + Image("notification") + .resizable() + .renderingMode(.template) + .frame(width: 30, height: 30) + .foregroundStyle(type == .home ? .black : .white) + } + case .myPage: + EmptyView() + } + } + public var body: some View { + HStack { + titleSection Spacer() - - Image("notification") - .resizable() - .frame(width: 30, height: 30) + notificationSection } - .padding() } } #Preview { - HeaderBar() + HeaderBar(type: .home) } diff --git a/Community/Sources/Presentation/Detail/CommunityDetail.swift b/Community/Sources/Presentation/Detail/CommunityDetail.swift index 6a756a0..5adb4a9 100644 --- a/Community/Sources/Presentation/Detail/CommunityDetail.swift +++ b/Community/Sources/Presentation/Detail/CommunityDetail.swift @@ -112,7 +112,7 @@ public struct CommunityDetailView: View { } } } - .navigationBarHidden(true) + .toolbar(.hidden, for: .navigationBar) .confirmationDialog("댓글", isPresented: $showCommentActionSheet, presenting: selectedComment) { comment in // Only show edit/delete buttons if the current user is the author if let currentUserId = viewModel.currentUserId, diff --git a/Community/Sources/Presentation/Report/CommunityReportView.swift b/Community/Sources/Presentation/Report/CommunityReportView.swift index e90bc07..9c39c62 100644 --- a/Community/Sources/Presentation/Report/CommunityReportView.swift +++ b/Community/Sources/Presentation/Report/CommunityReportView.swift @@ -57,7 +57,7 @@ public struct CommunityReportView: View { .padding(.horizontal, 18) } .background(Color.bgWhite) - .navigationBarHidden(true) + .toolbar(.hidden, for: .navigationBar) } private var navigationBar: some View { diff --git a/Community/Sources/Presentation/Write/CommunityWriteView.swift b/Community/Sources/Presentation/Write/CommunityWriteView.swift index 3f27768..7b16621 100644 --- a/Community/Sources/Presentation/Write/CommunityWriteView.swift +++ b/Community/Sources/Presentation/Write/CommunityWriteView.swift @@ -108,7 +108,7 @@ public struct CommunityWriteView: View { } .tabBarHidden(true) } - .navigationBarHidden(true) + .toolbar(.hidden, for: .navigationBar) } private var navigationBar: some View { diff --git a/Hambug.xcodeproj/project.pbxproj b/Hambug.xcodeproj/project.pbxproj index aa140b2..dd3858d 100644 --- a/Hambug.xcodeproj/project.pbxproj +++ b/Hambug.xcodeproj/project.pbxproj @@ -537,6 +537,7 @@ }; 915BC5F62E3CB9B80062B78E /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B513799A2EE2ED8F00DAF2F7 /* Common.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; diff --git a/Home/Sources/Presentation/HomeView.swift b/Home/Sources/Presentation/HomeView.swift index 82e76e5..d2a1207 100644 --- a/Home/Sources/Presentation/HomeView.swift +++ b/Home/Sources/Presentation/HomeView.swift @@ -23,13 +23,16 @@ public struct HomeView: View { public var body: some View { ZStack { Color.bgG100 + .ignoresSafeArea(.container, edges: .top) VStack { - HeaderBar() + HeaderBar(type: .home) + .safeAreaPadding(18) ScrollView { SuggestView(burgers: viewModel.recommendedBurgers) .padding(.leading, 18) + .padding(.top, 10) Spacer() .frame(height: 30) @@ -40,9 +43,8 @@ public struct HomeView: View { } .safeAreaPadding(.bottom, 60) } - .padding(.top, 50) } - .ignoresSafeArea(.container, edges: .top) + .tabBarHidden(false) } } diff --git a/Home/Sources/Presentation/SuggestView.swift b/Home/Sources/Presentation/SuggestView.swift index cea187d..a79c596 100644 --- a/Home/Sources/Presentation/SuggestView.swift +++ b/Home/Sources/Presentation/SuggestView.swift @@ -29,7 +29,7 @@ public struct SuggestView: View { } } else { ScrollView(.horizontal) { - HStack(spacing: 20) { + HStack(spacing: 8) { ForEach(burgers) { burger in SingleSuggestView(burger: burger) } diff --git a/MyPage/Sources/Presentation/MyActivitiesView.swift b/MyPage/Sources/Presentation/MyActivitiesView.swift index 13bd4ad..185eacb 100644 --- a/MyPage/Sources/Presentation/MyActivitiesView.swift +++ b/MyPage/Sources/Presentation/MyActivitiesView.swift @@ -32,7 +32,7 @@ public struct MyActivitiesView: View { } .background(Color.bgG75) } - .navigationBarHidden(true) + .toolbar(.hidden, for: .navigationBar) .refreshable { viewModel.refreshCurrentTab() } diff --git a/MyPage/Sources/Presentation/MyPage/MyPage+LocalizedString.swift b/MyPage/Sources/Presentation/MyPage/MyPage+LocalizedString.swift index 651625e..336c073 100644 --- a/MyPage/Sources/Presentation/MyPage/MyPage+LocalizedString.swift +++ b/MyPage/Sources/Presentation/MyPage/MyPage+LocalizedString.swift @@ -26,7 +26,6 @@ extension String.LocalizedString { } public enum MyPage { - static let header: String = "마이페이지" struct ActionSheetTitle2 { static let profile = "프로필 설정" } diff --git a/MyPage/Sources/Presentation/MyPage/MyPageView.swift b/MyPage/Sources/Presentation/MyPage/MyPageView.swift index f13b613..af63fb1 100644 --- a/MyPage/Sources/Presentation/MyPage/MyPageView.swift +++ b/MyPage/Sources/Presentation/MyPage/MyPageView.swift @@ -41,6 +41,7 @@ public struct MyPageView: View { NavigationStack { ZStack { Color.white + .ignoresSafeArea(.container, edges: .vertical) VStack(spacing: 0) { headerSection @@ -138,7 +139,7 @@ public struct MyPageView: View { Text("이미지 크기가 너무 큽니다. 10MB 이하의 이미지를 선택해주세요.") } } - .navigationBarHidden(true) + .toolbar(.hidden, for: .navigationBar) .onAppear { Task { await viewModel.fetchProfile() @@ -153,14 +154,8 @@ public struct MyPageView: View { // MARK: - Sections private var headerSection: some View { - HStack { - Text(Strings.header) - .padding(.leading, 15) - .padding(.bottom, 15) - .pretendard(.title(.t2)) - .foregroundStyle(Color.textG900) - Spacer() - } + HeaderBar(type: .myPage) + .safeAreaPadding(18) } private var imageSection: some View { @@ -192,7 +187,7 @@ public struct MyPageView: View { .onTapGesture { showInfoActionSheet = true } - .padding(.top, 25) + .padding(.top, 20) } private var nicknameSection: some View { @@ -414,8 +409,6 @@ struct MyPageBottomLineTextField: View { extension MyPageView { enum Strings { - static let header = "마이페이지" - enum ActionSheetTitle { static let profile = "프로필 설정" static let changeNickname = "닉네임 변경"