Skip to content

Commit 0db250b

Browse files
applebuddyios-min
authored andcommitted
[Fix] #319 카페 검색 리스트, thumbnail image, placeholder 사양 수정
1 parent 4eb37fa commit 0db250b

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

Projects/Coffice/Sources/App/Main/Search/CafeSearch/CafeSearchListCell.swift

+34-10
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,31 @@ struct CafeSearchListCell: View {
5656
ScrollView(.horizontal, showsIndicators: false) {
5757
HStack(spacing: 8) {
5858
if let imageUrls = cafe.imageUrls, imageUrls.isNotEmpty {
59-
ForEach(imageUrls, id: \.self) { imageUrl in
60-
KFImage.url(URL(string: imageUrl))
61-
.placeholder { CofficeAsset.Asset.cafePlaceholder.swiftUIImage }
62-
.resizable()
59+
ForEach(imageUrls, id: \.self) { imageUrlString in
60+
if let imageUrl = URL(string: imageUrlString) {
61+
LinearGradient(
62+
gradient: Gradient(colors: [.black.opacity(0.06), .black.opacity(0.3)]),
63+
startPoint: .top,
64+
endPoint: .bottom
65+
)
66+
.background(
67+
alignment: .center,
68+
content: {
69+
KFImage.url(imageUrl)
70+
.resizable()
71+
.scaledToFill()
72+
}
73+
)
6374
.frame(width: 124, height: 112)
64-
.scaledToFit()
75+
.clipped()
6576
.cornerRadius(4, corners: .allCorners)
77+
} else {
78+
placeholderImage
79+
}
6680
}
6781
} else {
6882
ForEach(1...3, id: \.self) { imageAsset in
69-
CofficeAsset.Asset.cafePlaceholder.swiftUIImage
70-
.resizable()
71-
.frame(width: 124, height: 112)
72-
.scaledToFit()
73-
.cornerRadius(4, corners: .allCorners)
83+
placeholderImage
7484
}
7585
}
7686
}
@@ -84,6 +94,20 @@ struct CafeSearchListCell: View {
8494
}
8595
}
8696
}
97+
98+
var placeholderImage: some View {
99+
CofficeAsset.Colors.grayScale2.swiftUIColor
100+
.frame(width: 124, height: 112)
101+
.cornerRadius(4, corners: .allCorners)
102+
.overlay(
103+
alignment: .center,
104+
content: {
105+
CofficeAsset.Asset.icPlaceholder.swiftUIImage
106+
.resizable()
107+
.frame(width: 44, height: 44)
108+
}
109+
)
110+
}
87111
}
88112

89113
struct CafeSearchListCell_Previews: PreviewProvider {

0 commit comments

Comments
 (0)