mirror of
https://github.com/VernissageApp/Vernissage.git
synced 2024-12-28 01:41:40 +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(.top, -4)
|
||||||
.padding(.leading, -4)
|
.padding(.leading, -4)
|
||||||
|
|
||||||
// if status.mediaAttachments.count > 0 {
|
if status.mediaAttachments.count > 0 {
|
||||||
// LazyVGrid(columns: self.getColumns(status: status), alignment: .center, spacing: 4) {
|
LazyVGrid(
|
||||||
// ForEach(status.mediaAttachments, id: \.id) { attachment in
|
columns: status.mediaAttachments.count == 1 ? [GridItem(.flexible())]: [GridItem(.flexible()), GridItem(.flexible())],
|
||||||
// AsyncImage(url: status.mediaAttachments[0].url) { image in
|
alignment: .center,
|
||||||
// image
|
spacing: 4
|
||||||
// .resizable()
|
) {
|
||||||
// .scaledToFill()
|
ForEach(status.mediaAttachments, id: \.id) { attachment in
|
||||||
// .frame(minWidth: 0, maxWidth: .infinity)
|
AsyncImage(url: attachment.url) { image in
|
||||||
// .frame(height: status.mediaAttachments.count == 1 ? 200 : 100)
|
image
|
||||||
// .cornerRadius(10)
|
.resizable()
|
||||||
// .shadow(color: .mainTextColor.opacity(0.3), radius: 2)
|
.scaledToFill()
|
||||||
// } placeholder: {
|
.frame(minWidth: 0, maxWidth: .infinity)
|
||||||
// Image(systemName: "photo")
|
.frame(height: status.mediaAttachments.count == 1 ? 200 : 100)
|
||||||
// .resizable()
|
.cornerRadius(10)
|
||||||
// .scaledToFit()
|
.shadow(color: .mainTextColor.opacity(0.3), radius: 2)
|
||||||
// .frame(minWidth: 0, maxWidth: .infinity)
|
} placeholder: {
|
||||||
// .frame(height: status.mediaAttachments.count == 1 ? 200 : 100)
|
Image(systemName: "photo")
|
||||||
// .foregroundColor(.mainTextColor)
|
.resizable()
|
||||||
// .opacity(0.05)
|
.scaledToFit()
|
||||||
// }
|
.frame(minWidth: 0, maxWidth: .infinity)
|
||||||
// }
|
.frame(height: status.mediaAttachments.count == 1 ? 200 : 100)
|
||||||
// }
|
.foregroundColor(.mainTextColor)
|
||||||
// .padding(.bottom, 8)
|
.opacity(0.05)
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(.bottom, 8)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
withAnimation(.linear(duration: 0.3)) {
|
withAnimation(.linear(duration: 0.3)) {
|
||||||
@ -152,10 +156,6 @@ struct CommentsSection: View {
|
|||||||
return status.account?.displayName ?? status.account?.acct ?? status.account?.username ?? ""
|
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 {
|
private func getInteractionRowTextColor() -> Color {
|
||||||
return self.colorScheme == .dark ? Color.black : Color.white
|
return self.colorScheme == .dark ? Color.black : Color.white
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user