Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 65 additions & 16 deletions Common/Sources/DesignSystem/HeaderBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public struct CommunityWriteView: View {
}
.tabBarHidden(true)
}
.navigationBarHidden(true)
.toolbar(.hidden, for: .navigationBar)
}

private var navigationBar: some View {
Expand Down
1 change: 1 addition & 0 deletions Hambug.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions Home/Sources/Presentation/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -40,9 +43,8 @@ public struct HomeView: View {
}
.safeAreaPadding(.bottom, 60)
}
.padding(.top, 50)
}
.ignoresSafeArea(.container, edges: .top)

.tabBarHidden(false)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Home/Sources/Presentation/SuggestView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public struct SuggestView: View {
}
} else {
ScrollView(.horizontal) {
HStack(spacing: 20) {
HStack(spacing: 8) {
ForEach(burgers) { burger in
SingleSuggestView(burger: burger)
}
Expand Down
2 changes: 1 addition & 1 deletion MyPage/Sources/Presentation/MyActivitiesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public struct MyActivitiesView: View {
}
.background(Color.bgG75)
}
.navigationBarHidden(true)
.toolbar(.hidden, for: .navigationBar)
.refreshable {
viewModel.refreshCurrentTab()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ extension String.LocalizedString {
}

public enum MyPage {
static let header: String = "마이페이지"
struct ActionSheetTitle2 {
static let profile = "프로필 설정"
}
Expand Down
17 changes: 5 additions & 12 deletions MyPage/Sources/Presentation/MyPage/MyPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public struct MyPageView: View {
NavigationStack {
ZStack {
Color.white
.ignoresSafeArea(.container, edges: .vertical)

VStack(spacing: 0) {
headerSection
Expand Down Expand Up @@ -138,7 +139,7 @@ public struct MyPageView: View {
Text("이미지 크기가 너무 큽니다. 10MB 이하의 이미지를 선택해주세요.")
}
}
.navigationBarHidden(true)
.toolbar(.hidden, for: .navigationBar)
.onAppear {
Task {
await viewModel.fetchProfile()
Expand All @@ -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 {
Expand Down Expand Up @@ -192,7 +187,7 @@ public struct MyPageView: View {
.onTapGesture {
showInfoActionSheet = true
}
.padding(.top, 25)
.padding(.top, 20)
}

private var nicknameSection: some View {
Expand Down Expand Up @@ -414,8 +409,6 @@ struct MyPageBottomLineTextField: View {

extension MyPageView {
enum Strings {
static let header = "마이페이지"

enum ActionSheetTitle {
static let profile = "프로필 설정"
static let changeNickname = "닉네임 변경"
Expand Down
Loading