context item background with shadow

This commit is contained in:
spaced4ndy
2024-07-15 13:30:36 +04:00
parent 6c06e42061
commit fc4ad32417
7 changed files with 19 additions and 14 deletions
@@ -33,8 +33,7 @@ struct ComposeFileView: View {
.padding(.vertical, 1)
.padding(.trailing, 12)
.frame(height: 50)
.background(theme.appColors.sentMessage)
.background(composeContextItemBackground())
.frame(maxWidth: .infinity)
.padding(.top, 8)
}
}
@@ -45,9 +45,8 @@ struct ComposeImageView: View {
}
.padding(.vertical, 1)
.padding(.trailing, 12)
.background(theme.appColors.sentMessage)
.background(composeContextItemBackground())
.frame(maxWidth: .infinity)
.padding(.top, 8)
}
}
@@ -62,9 +62,13 @@ struct ComposeLinkView: View {
}
.padding(.vertical, 1)
.padding(.trailing, 12)
.background(theme.appColors.sentMessage)
.background(
Rectangle()
.fill(.thinMaterial)
.shadow(color: .black.opacity(0.12), radius: 4, x: 0, y: 0)
.mask(Rectangle().padding(.bottom, -8))
)
.frame(maxWidth: .infinity)
.padding(.top, 8)
}
private func linkPreviewView(_ linkPreview: LinkPreview) -> some View {
@@ -664,8 +664,7 @@ struct ComposeView: View {
.padding(12)
.frame(minHeight: 50)
.frame(maxWidth: .infinity, alignment: .leading)
.background(Color(uiColor: .tertiarySystemGroupedBackground))
.padding(.top, 8)
.background(composeContextItemBackground())
}
@ViewBuilder private func contextItemView() -> some View {
@@ -50,9 +50,8 @@ struct ComposeVoiceView: View {
}
.padding(.vertical, 1)
.frame(height: ComposeVoiceView.previewHeight)
.background(theme.appColors.sentMessage)
.background(composeContextItemBackground())
.frame(maxWidth: .infinity)
.padding(.top, 8)
}
private func recordingMode() -> some View {
@@ -20,8 +20,7 @@ struct ContextInvitingContactMemberView: View {
.padding(12)
.frame(minHeight: 50)
.frame(maxWidth: .infinity, alignment: .leading)
.background(theme.appColors.sentMessage)
.padding(.top, 8)
.background(composeContextItemBackground())
}
}
@@ -9,6 +9,13 @@
import SwiftUI
import SimpleXChat
func composeContextItemBackground() -> some View {
Rectangle()
.fill(.thinMaterial)
.shadow(color: .black.opacity(0.12), radius: 2, x: 0, y: 0)
.mask(Rectangle().padding(.bottom, -8))
}
struct ContextItemView: View {
@EnvironmentObject var theme: AppTheme
@ObservedObject var chat: Chat
@@ -45,8 +52,7 @@ struct ContextItemView: View {
.padding(12)
.frame(minHeight: 50)
.frame(maxWidth: .infinity)
.background(chatItemFrameColor(contextItem, theme))
.padding(.top, 8)
.background(composeContextItemBackground())
}
private func msgContentView(lines: Int) -> some View {