mirror of
https://github.com/VernissageApp/Vernissage.git
synced 2024-12-27 09:23:45 +01:00
Fix images into comments
This commit is contained in:
parent
2ebfe762f0
commit
f10a32537c
@ -71,30 +71,34 @@ struct CommentsSection: View {
|
||||
.padding(.top, -4)
|
||||
.padding(.leading, -4)
|
||||
|
||||
// if status.mediaAttachments.count > 0 {
|
||||
// LazyVGrid(columns: self.getColumns(status: status), alignment: .center, spacing: 4) {
|
||||
// ForEach(status.mediaAttachments, id: \.id) { attachment in
|
||||
// AsyncImage(url: status.mediaAttachments[0].url) { image in
|
||||
// image
|
||||
// .resizable()
|
||||
// .scaledToFill()
|
||||
// .frame(minWidth: 0, maxWidth: .infinity)
|
||||
// .frame(height: status.mediaAttachments.count == 1 ? 200 : 100)
|
||||
// .cornerRadius(10)
|
||||
// .shadow(color: .mainTextColor.opacity(0.3), radius: 2)
|
||||
// } placeholder: {
|
||||
// Image(systemName: "photo")
|
||||
// .resizable()
|
||||
// .scaledToFit()
|
||||
// .frame(minWidth: 0, maxWidth: .infinity)
|
||||
// .frame(height: status.mediaAttachments.count == 1 ? 200 : 100)
|
||||
// .foregroundColor(.mainTextColor)
|
||||
// .opacity(0.05)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// .padding(.bottom, 8)
|
||||
// }
|
||||
if status.mediaAttachments.count > 0 {
|
||||
LazyVGrid(
|
||||
columns: status.mediaAttachments.count == 1 ? [GridItem(.flexible())]: [GridItem(.flexible()), GridItem(.flexible())],
|
||||
alignment: .center,
|
||||
spacing: 4
|
||||
) {
|
||||
ForEach(status.mediaAttachments, id: \.id) { attachment in
|
||||
AsyncImage(url: attachment.url) { image in
|
||||
image
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.frame(height: status.mediaAttachments.count == 1 ? 200 : 100)
|
||||
.cornerRadius(10)
|
||||
.shadow(color: .mainTextColor.opacity(0.3), radius: 2)
|
||||
} placeholder: {
|
||||
Image(systemName: "photo")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.frame(height: status.mediaAttachments.count == 1 ? 200 : 100)
|
||||
.foregroundColor(.mainTextColor)
|
||||
.opacity(0.05)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 8)
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
withAnimation(.linear(duration: 0.3)) {
|
||||
@ -152,10 +156,6 @@ struct CommentsSection: View {
|
||||
return status.account?.displayName ?? status.account?.acct ?? status.account?.username ?? ""
|
||||
}
|
||||
|
||||
private func getColumns(status: Status) -> [GridItem.Size] {
|
||||
return Array(repeating: .flexible(), count: status.mediaAttachments.count == 1 ? 1 : 2)
|
||||
}
|
||||
|
||||
private func getInteractionRowTextColor() -> Color {
|
||||
return self.colorScheme == .dark ? Color.black : Color.white
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user