인기 크리에이터 팔로우 해제 시 확인 다이얼로그 추가

This commit is contained in:
Yu Sung
2026-01-22 19:04:48 +09:00
parent 75452f0ffd
commit 4b9cdeb824
3 changed files with 64 additions and 11 deletions

View File

@@ -11,7 +11,7 @@ import Kingfisher
struct HomeCreatorRankingItemView: View {
let rank: Int
@State var item: GetExplorerSectionCreatorResponse
@Binding var item: GetExplorerSectionCreatorResponse
let onClickFollow: (Int, Bool) -> Void
@@ -57,11 +57,18 @@ struct HomeCreatorRankingItemView: View {
item.follow ? .white : Color(hex: "263238")
)
.onTapGesture {
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
item.follow = !item.follow
let trimmedToken = token.trimmingCharacters(in: .whitespacesAndNewlines)
guard !trimmedToken.isEmpty else {
onClickFollow(item.id, item.follow)
return
}
if item.follow {
onClickFollow(item.id, false)
} else {
item.follow = true
onClickFollow(item.id, true)
}
onClickFollow(item.id, item.follow)
}
}
}
@@ -76,12 +83,14 @@ struct HomeCreatorRankingItemView: View {
#Preview {
HomeCreatorRankingItemView(
rank: 1,
item: GetExplorerSectionCreatorResponse(
item: .constant(
GetExplorerSectionCreatorResponse(
id: 1,
nickname: "유빈ASMR",
tags: "",
profileImageUrl: "https://cf.sodalive.net/profile/34806/34806-profile-49db6b45-bb1e-4dc7-917e-1a614a853f5f-4232-1752158072656",
follow: true
)
),
onClickFollow: { _, _ in }
)