From 6a6537247f9b2342f95b5956ffa6c7a9bc551016 Mon Sep 17 00:00:00 2001 From: Minseo Park <125115284+FpRaArNkK@users.noreply.github.com> Date: Wed, 5 Feb 2025 20:03:49 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20Trainer/Trainee=20MainTab=20=EB=94=94?= =?UTF-8?q?=EC=9E=90=EC=9D=B8=20=EC=8B=9C=EC=8A=A4=ED=85=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../icn_feedback_empty.imageset/Contents.json | 2 +- .../icn_feedback.svg | 6 --- .../icn_feedback_empty.svg | 5 ++ .../icn_home_empty.imageset/Contents.json | 2 +- .../{icn_home.svg => icn_home_empty.svg} | 2 +- .../icn_list_empty.imageset/Contents.json | 2 +- .../icn_list_empty.imageset/icn_list.svg | 6 --- .../icn_list_empty.svg | 9 ++++ .../icn_mypage_empty.imageset/Contents.json | 2 +- .../icn_mypage_empty.imageset/icn_mypage.svg | 4 -- .../icn_mypage_empty.svg | 6 +++ .../Sources/Button/TMainTabButton.swift | 48 +++++++++++++++++++ .../Sources/MainTab/TabBar/TabInfo.swift | 4 +- .../MainTab/Trainee/TraineeMainTabView.swift | 29 ++--------- .../MainTab/Trainer/TrainerMainTabView.swift | 29 ++--------- 15 files changed, 85 insertions(+), 71 deletions(-) delete mode 100644 TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/icn_feedback.svg create mode 100644 TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/icn_feedback_empty.svg rename TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_home_empty.imageset/{icn_home.svg => icn_home_empty.svg} (80%) delete mode 100644 TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/icn_list.svg create mode 100644 TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/icn_list_empty.svg delete mode 100644 TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/icn_mypage.svg create mode 100644 TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/icn_mypage_empty.svg create mode 100644 TnT/Projects/DesignSystem/Sources/Button/TMainTabButton.swift diff --git a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/Contents.json b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/Contents.json index e5ab1b64..4e0b043a 100644 --- a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/Contents.json +++ b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "icn_feedback.svg", + "filename" : "icn_feedback_empty.svg", "idiom" : "universal" } ], diff --git a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/icn_feedback.svg b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/icn_feedback.svg deleted file mode 100644 index 6aa2ec46..00000000 --- a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/icn_feedback.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/icn_feedback_empty.svg b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/icn_feedback_empty.svg new file mode 100644 index 00000000..fc6e27d5 --- /dev/null +++ b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_feedback_empty.imageset/icn_feedback_empty.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_home_empty.imageset/Contents.json b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_home_empty.imageset/Contents.json index 938c0552..ca638fc8 100644 --- a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_home_empty.imageset/Contents.json +++ b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_home_empty.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "icn_home.svg", + "filename" : "icn_home_empty.svg", "idiom" : "universal" } ], diff --git a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_home_empty.imageset/icn_home.svg b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_home_empty.imageset/icn_home_empty.svg similarity index 80% rename from TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_home_empty.imageset/icn_home.svg rename to TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_home_empty.imageset/icn_home_empty.svg index d54958cb..a6c6b2a5 100644 --- a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_home_empty.imageset/icn_home.svg +++ b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_home_empty.imageset/icn_home_empty.svg @@ -1,3 +1,3 @@ - + diff --git a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/Contents.json b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/Contents.json index dc8559ae..7ec83d3d 100644 --- a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/Contents.json +++ b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "icn_list.svg", + "filename" : "icn_list_empty.svg", "idiom" : "universal" } ], diff --git a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/icn_list.svg b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/icn_list.svg deleted file mode 100644 index 2056ff42..00000000 --- a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/icn_list.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/icn_list_empty.svg b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/icn_list_empty.svg new file mode 100644 index 00000000..206298e1 --- /dev/null +++ b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_list_empty.imageset/icn_list_empty.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/Contents.json b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/Contents.json index 131a0ab6..777d1ac1 100644 --- a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/Contents.json +++ b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "icn_mypage.svg", + "filename" : "icn_mypage_empty.svg", "idiom" : "universal" } ], diff --git a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/icn_mypage.svg b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/icn_mypage.svg deleted file mode 100644 index 538a4e4b..00000000 --- a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/icn_mypage.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/icn_mypage_empty.svg b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/icn_mypage_empty.svg new file mode 100644 index 00000000..54fbbdbc --- /dev/null +++ b/TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_mypage_empty.imageset/icn_mypage_empty.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/TnT/Projects/DesignSystem/Sources/Button/TMainTabButton.swift b/TnT/Projects/DesignSystem/Sources/Button/TMainTabButton.swift new file mode 100644 index 00000000..b674bea6 --- /dev/null +++ b/TnT/Projects/DesignSystem/Sources/Button/TMainTabButton.swift @@ -0,0 +1,48 @@ +// +// TMainTabButton.swift +// DesignSystem +// +// Created by 박민서 on 2/5/25. +// Copyright © 2025 yapp25thTeamTnT. All rights reserved. +// + +import SwiftUI + +/// TnT 앱 내에서 바텀 탭에 사용되는 버튼 컴포넌트 입니다 +public struct TMainTabButton: View { + let unselectedIcon: ImageResource + let selectedIcon: ImageResource + let text: String + let isSelected: Bool + let action: () -> Void + + public init( + unselectedIcon: ImageResource, + selectedIcon: ImageResource, + text: String, + isSelected: Bool, + action: @escaping () -> Void + ) { + self.unselectedIcon = unselectedIcon + self.selectedIcon = selectedIcon + self.text = text + self.isSelected = isSelected + self.action = action + } + + public var body: some View { + Button(action: action) { + VStack(spacing: 4) { + Image(isSelected ? selectedIcon : unselectedIcon) + .resizable() + .frame(width: 24, height: 24) + Text(text) + .typographyStyle( + isSelected ? .label2Bold : .label1Medium, + with: isSelected ? .neutral900 : .neutral400 + ) + } + } + .padding(.vertical, 8) + } +} diff --git a/TnT/Projects/Presentation/Sources/MainTab/TabBar/TabInfo.swift b/TnT/Projects/Presentation/Sources/MainTab/TabBar/TabInfo.swift index 1a043d6a..07b5f976 100644 --- a/TnT/Projects/Presentation/Sources/MainTab/TabBar/TabInfo.swift +++ b/TnT/Projects/Presentation/Sources/MainTab/TabBar/TabInfo.swift @@ -13,7 +13,7 @@ public enum TrainerTabInfo: String, CaseIterable, Equatable, Sendable { case home = "홈" case feedback = "피드백" case traineeList = "회원목록" - case mypage = "마이페이지" + case mypage = "내 정보" public var filledIcn: ImageResource { switch self { @@ -44,7 +44,7 @@ public enum TrainerTabInfo: String, CaseIterable, Equatable, Sendable { public enum TraineeTabInfo: String, CaseIterable, Equatable, Sendable { case home = "홈" - case mypage = "마이페이지" + case mypage = "내 정보" var filledIcn: ImageResource { switch self { diff --git a/TnT/Projects/Presentation/Sources/MainTab/Trainee/TraineeMainTabView.swift b/TnT/Projects/Presentation/Sources/MainTab/Trainee/TraineeMainTabView.swift index 811c2a06..894cdb1f 100644 --- a/TnT/Projects/Presentation/Sources/MainTab/Trainee/TraineeMainTabView.swift +++ b/TnT/Projects/Presentation/Sources/MainTab/Trainee/TraineeMainTabView.swift @@ -43,10 +43,12 @@ public struct TraineeMainTabView: View { HStack(alignment: .top) { ForEach(TraineeTabInfo.allCases, id: \.hashValue) { tab in Spacer() - TabButton( - icon: store.state.tabInfo == tab ? tab.filledIcn : tab.emptyIcn, + TMainTabButton( + unselectedIcon: tab.emptyIcn, + selectedIcon: tab.filledIcn, text: tab.rawValue, - action: { send(.selectTab(tab))} + isSelected: store.state.tabInfo == tab, + action: { send(.selectTab(tab)) } ) .frame(maxHeight: .infinity, alignment: .top) Spacer() @@ -57,24 +59,3 @@ public struct TraineeMainTabView: View { .background(Color.white.shadow(radius: 5).opacity(0.5)) } } - -private extension TraineeMainTabView { - struct TabButton: View { - let icon: ImageResource - let text: String - let action: () -> Void - - var body: some View { - Button(action: action) { - VStack(spacing: 4) { - Image(icon) - .resizable() - .frame(width: 24, height: 24) - Text(text) - .typographyStyle(.label2Bold, with: .neutral900) - } - } - .padding(.vertical, 8) - } - } -} diff --git a/TnT/Projects/Presentation/Sources/MainTab/Trainer/TrainerMainTabView.swift b/TnT/Projects/Presentation/Sources/MainTab/Trainer/TrainerMainTabView.swift index a6d42a22..b5bb9ec7 100644 --- a/TnT/Projects/Presentation/Sources/MainTab/Trainer/TrainerMainTabView.swift +++ b/TnT/Projects/Presentation/Sources/MainTab/Trainer/TrainerMainTabView.swift @@ -53,10 +53,12 @@ public struct TrainerMainTabView: View { HStack(alignment: .top) { ForEach(TrainerTabInfo.allCases, id: \.hashValue) { tab in Spacer() - TabButton( - icon: store.state.tabInfo == tab ? tab.filledIcn : tab.emptyIcn, + TMainTabButton( + unselectedIcon: tab.emptyIcn, + selectedIcon: tab.filledIcn, text: tab.rawValue, - action: { send(.selectTab(tab))} + isSelected: store.state.tabInfo == tab, + action: { send(.selectTab(tab)) } ) .frame(maxHeight: .infinity, alignment: .top) Spacer() @@ -67,24 +69,3 @@ public struct TrainerMainTabView: View { .background(Color.white.shadow(radius: 5).opacity(0.5)) } } - -private extension TrainerMainTabView { - struct TabButton: View { - let icon: ImageResource - let text: String - let action: () -> Void - - var body: some View { - Button(action: action) { - VStack(spacing: 4) { - Image(icon) - .resizable() - .frame(width: 24, height: 24) - Text(text) - .typographyStyle(.label2Bold, with: .neutral900) - } - } - .padding(.vertical, 8) - } - } -}