Skip to content

Commit

Permalink
[Feat] Trainer/Trainee MainTab 디자인 시스템 수정 사항 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
FpRaArNkK committed Feb 5, 2025
1 parent 151cefb commit 6a65372
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "icn_feedback.svg",
"filename" : "icn_feedback_empty.svg",
"idiom" : "universal"
}
],
Expand Down

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "icn_home.svg",
"filename" : "icn_home_empty.svg",
"idiom" : "universal"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "icn_list.svg",
"filename" : "icn_list_empty.svg",
"idiom" : "universal"
}
],
Expand Down

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "icn_mypage.svg",
"filename" : "icn_mypage_empty.svg",
"idiom" : "universal"
}
],
Expand Down

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions TnT/Projects/DesignSystem/Sources/Button/TMainTabButton.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
}
}
}

0 comments on commit 6a65372

Please sign in to comment.