mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Render galleries with non-visual attachments as a list (#5932)
* Render galleries with non-visual attachments as a list Adds GalleryListView (with GalleryDivider) for galleries containing a file or audio item, extracting the shared FileTypeIconView from FileRoomTimelineView. GalleryRoomTimelineView picks the list vs the grid via usesListLayout. Tapping to open the preview lands in a follow-up. Co-authored-by: svetoslav.mitov <svetoslav.mitov@sportinno.com> * pr suggestions --------- Co-authored-by: svetoslav.mitov <svetoslav.mitov@sportinno.com>
This commit is contained in:
+23
-12
@@ -102,24 +102,35 @@ struct MediaFileRoomTimelineContent: View {
|
||||
.foregroundStyle(.compound.textPrimary)
|
||||
.lineLimit(2)
|
||||
} icon: {
|
||||
Group {
|
||||
if isScanning {
|
||||
ProgressView()
|
||||
.scaledFrame(size: CompoundIcon.Size.medium.value, relativeTo: .body)
|
||||
} else {
|
||||
CompoundIcon(icon, size: .medium, relativeTo: .body)
|
||||
.foregroundColor(.compound.iconPrimary)
|
||||
}
|
||||
}
|
||||
.scaledPadding(6)
|
||||
.background(.compound.iconOnSolidPrimary,
|
||||
in: RoundedRectangle(cornerRadius: 4, style: .continuous))
|
||||
FileTypeIconView(icon: icon, isScanning: isScanning)
|
||||
}
|
||||
.labelStyle(.custom(spacing: 8, alignment: .center))
|
||||
.padding(.horizontal, 4) // Add to the styler's padding of 8, as we use the default insets for the caption.
|
||||
}
|
||||
}
|
||||
|
||||
/// The rounded icon badge used as the leading accessory of a file/audio row, either showing the
|
||||
/// file-type icon or a scanning spinner.
|
||||
struct FileTypeIconView: View {
|
||||
let icon: KeyPath<CompoundIcons, Image>
|
||||
var isScanning = false
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if isScanning {
|
||||
ProgressView()
|
||||
.scaledFrame(size: CompoundIcon.Size.medium.value, relativeTo: .compound.bodyLG)
|
||||
} else {
|
||||
CompoundIcon(icon)
|
||||
.foregroundColor(.compound.iconPrimary)
|
||||
}
|
||||
}
|
||||
.scaledPadding(6)
|
||||
.background(.compound.iconOnSolidPrimary,
|
||||
in: RoundedRectangle(cornerRadius: 4))
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
struct FileRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
Reference in New Issue
Block a user