feat(chat-character): 추천 캐릭터 섹션 추가 및 새로고침 API 반영
This commit is contained in:
@@ -63,6 +63,51 @@ struct CharacterView: View {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if !viewModel.recommendCharacters.isEmpty {
|
||||
VStack(alignment: .leading, spacing: 16) {
|
||||
HStack {
|
||||
Text("추천 캐릭터")
|
||||
.font(.custom(Font.preBold.rawValue, size: 24))
|
||||
.foregroundColor(.white)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image("ic_refresh")
|
||||
.onTapGesture {
|
||||
viewModel.refreshRecommendCharacters()
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
|
||||
let horizontalPadding: CGFloat = 24
|
||||
let gridSpacing: CGFloat = 16
|
||||
let width = (screenSize().width - (horizontalPadding * 2) - gridSpacing) / 2
|
||||
|
||||
LazyVGrid(
|
||||
columns: Array(
|
||||
repeating: GridItem(
|
||||
.flexible(),
|
||||
spacing: gridSpacing,
|
||||
alignment: .topLeading
|
||||
),
|
||||
count: 2
|
||||
),
|
||||
alignment: .leading,
|
||||
spacing: gridSpacing
|
||||
) {
|
||||
ForEach(viewModel.recommendCharacters.indices, id: \.self) { idx in
|
||||
CharacterItemView(
|
||||
character: viewModel.recommendCharacters[idx],
|
||||
size: width,
|
||||
rank: idx + 1,
|
||||
isShowRank: false
|
||||
)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, horizontalPadding)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 24)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user