diff --git a/Anytype/Sources/PresentationLayer/Modules/Discussion/Subviews/LinkObject/MessageLinkInputViewContainer.swift b/Anytype/Sources/PresentationLayer/Modules/Discussion/Subviews/LinkObject/MessageLinkInputViewContainer.swift index 33d0958643..3b9a6f3a89 100644 --- a/Anytype/Sources/PresentationLayer/Modules/Discussion/Subviews/LinkObject/MessageLinkInputViewContainer.swift +++ b/Anytype/Sources/PresentationLayer/Modules/Discussion/Subviews/LinkObject/MessageLinkInputViewContainer.swift @@ -7,7 +7,7 @@ struct MessageLinkInputViewContainer: View { let objects: [ObjectDetails] let onTapRemove: (ObjectDetails) -> Void - @State private var itemWidth: CGFloat = 0 + @State private var sizeWidth: CGFloat = 0 var body: some View { if objects.isNotEmpty { @@ -17,7 +17,7 @@ struct MessageLinkInputViewContainer: View { private var content: some View { ScrollView(.horizontal) { - HStack { + HStack(spacing: 12) { ForEach(objects, id: \.id) { MessageLinkObjectView(details: $0, style: .input, onTapRemove: onTapRemove) .frame(width: itemWidth) @@ -29,9 +29,14 @@ struct MessageLinkInputViewContainer: View { .scrollIndicators(.hidden) .background(Color.Background.primary) .readSize { size in - itemWidth = size.width - 32 + sizeWidth = size.width } } + + private var itemWidth: CGFloat { + let width = sizeWidth - (objects.count > 1 ? 64 : 32) + return max(width, 0) + } } #Preview { diff --git a/Anytype/Sources/PresentationLayer/Modules/Discussion/Subviews/LinkObject/MessageLinkObjectView.swift b/Anytype/Sources/PresentationLayer/Modules/Discussion/Subviews/LinkObject/MessageLinkObjectView.swift index 655f5927a4..bf1e8da6f2 100644 --- a/Anytype/Sources/PresentationLayer/Modules/Discussion/Subviews/LinkObject/MessageLinkObjectView.swift +++ b/Anytype/Sources/PresentationLayer/Modules/Discussion/Subviews/LinkObject/MessageLinkObjectView.swift @@ -38,7 +38,7 @@ struct MessageLinkObjectView: View { Button { onTapRemove() } label: { - IconView(asset: .X24.removeRed) + IconView(asset: .X18.clear) } .padding([.top, .trailing], -6) }