feat(character-detail): 캐릭터 정보 추가

- mbti, 나이, 성별 추가
This commit is contained in:
Yu Sung
2025-09-05 18:20:04 +09:00
parent 557a4421e7
commit 70b7801074
2 changed files with 75 additions and 7 deletions

View File

@@ -167,19 +167,85 @@ extension CharacterDetailView {
// MARK: - Character Image Section
extension CharacterDetailView {
private var characterImageSection: some View {
//
KFImage(URL(string: viewModel.characterDetail?.imageUrl ?? "https://picsum.photos/400"))
.resizable()
.scaledToFill()
.frame(width: screenSize().width, height: screenSize().width, alignment: .top)
.clipped()
ZStack {
if let imageUrl = viewModel.characterDetail?.imageUrl{
//
KFImage(URL(string: imageUrl))
.resizable()
.scaledToFill()
.frame(width: screenSize().width, height: screenSize().width, alignment: .top)
.clipped()
}
}
}
}
// MARK: - Profile Section
extension CharacterDetailView {
private var profileSection: some View {
VStack(alignment: .leading, spacing: 8) {
VStack(alignment: .leading, spacing: 16) {
if viewModel.characterDetail?.mbti != nil ||
viewModel.characterDetail?.gender != nil ||
viewModel.characterDetail?.age != nil
{
HStack(spacing: 4) {
if let gender = viewModel.characterDetail?.gender {
Text(gender)
.font(.custom(Font.preRegular.rawValue, size: 14))
.foregroundColor(
gender == "남성" ?
Color.button :
Color.mainRed
)
.padding(.horizontal, 7)
.padding(.vertical, 3)
.background(Color(hex: "263238"))
.cornerRadius(4)
.overlay {
RoundedRectangle(cornerRadius: 4)
.stroke(lineWidth: 1)
.foregroundColor(
gender == "남성" ?
Color.button :
Color.mainRed
)
}
}
if let age = viewModel.characterDetail?.age {
Text("\(age)")
.font(.custom(Font.preRegular.rawValue, size: 14))
.foregroundColor(Color(hex: "B0BEC5"))
.padding(.horizontal, 7)
.padding(.vertical, 3)
.background(Color(hex: "263238"))
.cornerRadius(4)
.overlay {
RoundedRectangle(cornerRadius: 4)
.stroke(lineWidth: 1)
.foregroundColor(.white.opacity(0.5))
}
}
if let mbti = viewModel.characterDetail?.mbti {
Text(mbti)
.font(.custom(Font.preRegular.rawValue, size: 14))
.foregroundColor(Color(hex: "B0BEC5"))
.padding(.horizontal, 7)
.padding(.vertical, 3)
.background(Color(hex: "263238"))
.cornerRadius(4)
.overlay {
RoundedRectangle(cornerRadius: 4)
.stroke(lineWidth: 1)
.foregroundColor(.white.opacity(0.5))
}
}
}
}
//
HStack(spacing: 8) {
Text(viewModel.characterDetail?.name ?? "")