Skip to content

Commit

Permalink
[Fix/#26] Struct 로 OwnerProfile에 들어갈 정보 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
HEHEEUN committed Jan 15, 2025
1 parent 912acae commit 48ed36c
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@

import SwiftUI

struct OwnerProfileBox: View {
// MARK: - TODO: Model로 분리

struct OwnerProfileData {
var profileImage: Int
var nickname: String
var sex: String
var schoolMajor: String
var enterYear: Int
var schoolGrade: Int
var mbti: String
}

struct OwnerProfileBox: View {
let ownerData: OwnerProfileData

var body: some View {
ZStack(alignment: .leading) {
Expand All @@ -25,31 +31,31 @@ struct OwnerProfileBox: View {
Image(systemName: "person")
.resizable()
.frame(width: 80, height: 80)
.background(.gray04) // MARK: - 이미지 삽입 시 삭제
.foregroundStyle(.mainOrange) // MARK: - 이미지 삽입 시 삭제
.background(.gray04) // MARK: - TODO: 이미지 삽입 시 삭제
.foregroundStyle(.mainOrange) // MARK: - TODO: 이미지 삽입 시 삭제

VStack(alignment: .leading, spacing: 6) {
HStack(spacing: 6) {
Text(nickname)
Text(ownerData.nickname)
.pretendardFont(.body1_b_16)
.foregroundStyle(.grayBlack)

Image(sex == "MAN" ? .icMale20 : .icFemale20)
Image(ownerData.sex == "MAN" ? .icMale20 : .icFemale20)
.resizable()
.frame(width: 20, height: 20)
.foregroundStyle(.gray06)
}

MajorChip(major: schoolMajor, targetObject: .ownerProfile)
MajorChip(major: ownerData.schoolMajor, targetObject: .ownerProfile)

HStack(spacing: 6) {
ProfileDetailChip(detailCategory: "학번/학년")
Text("\(enterYear%100)학번 \(schoolGrade)학년")
Text("\(ownerData.enterYear%100)학번 \(ownerData.schoolGrade)학년")
.foregroundStyle(.gray08)
.pretendardFont(.caption2_m_12)
.padding(.trailing, 6)
ProfileDetailChip(detailCategory: "MBTI")
Text(mbti)
Text(ownerData.mbti)
.foregroundStyle(.gray08)
.pretendardFont(.caption2_m_12)
}
Expand All @@ -61,5 +67,5 @@ struct OwnerProfileBox: View {
}

#Preview {
OwnerProfileBox(profileImage: 1, nickname: "로이임탄", sex: "MALE", schoolMajor: "글로벌문화산업/MICE 전공", enterYear: 2019, schoolGrade: 4, mbti: "ENFJ")
OwnerProfileBox(ownerData: OwnerProfileData(profileImage: 1, nickname: "로이임탄", sex: "MALE", schoolMajor: "글로벌문화산업/MICE 전공", enterYear: 2019, schoolGrade: 4, mbti: "ENFJ"))
}

0 comments on commit 48ed36c

Please sign in to comment.