This commit is contained in:
fmodf 2024-08-06 18:53:22 +02:00
parent 6006275690
commit bf77fb8188
2 changed files with 35 additions and 14 deletions

View file

@ -3,8 +3,6 @@ import SwiftUI
struct ChatsListScreen: View {
@EnvironmentObject var store: AppStore
@State private var isShowingAddScreen = false
var body: some View {
ZStack {
// Background color
@ -14,7 +12,7 @@ struct ChatsListScreen: View {
// Content
VStack(spacing: 0) {
// Header
ChatsScreenHeader(isShowingAddScreen: $isShowingAddScreen)
ChatsScreenHeader()
// Chats list
if !store.state.chatsState.chats.isEmpty {
@ -33,16 +31,10 @@ struct ChatsListScreen: View {
SharedTabBar()
}
}
.sheet(isPresented: $isShowingAddScreen) {
CreateRoomScreen()
.transition(.move(edge: .bottom))
}
}
}
private struct ChatsScreenHeader: View {
@Binding var isShowingAddScreen: Bool
var body: some View {
ZStack {
// bg
@ -59,7 +51,7 @@ private struct ChatsScreenHeader: View {
Image(systemName: "square.and.pencil")
.foregroundColor(.Material.Elements.active)
.tappablePadding(.symmetric(12)) {
isShowingAddScreen = true
// print("Create new chat")
}
}
.padding(.horizontal, 16)

View file

@ -15,12 +15,20 @@ struct CreateRoomScreen: View {
// Header
CreateRoomScreenHeader(presentationMode: presentationMode)
// Create room form
// CreateRoomForm()
// List with buttons
List {
CreateRoomRowButton(title: "Create group chat", image: "person.2.square.stack") {
print("Create chat")
}
CreateRoomRowButton(title: "Find public chats", image: "magnifyingglass") {
print("Create group chat")
}
}
.listStyle(.plain)
.background(Color.Material.Background.light)
// Tab bar
Spacer()
Text("test")
}
}
}
@ -46,9 +54,30 @@ private struct CreateRoomScreenHeader: View {
}
// title
Text("New")
Text("New conversation")
.font(.head2)
.foregroundColor(Color.Material.Text.main)
}
}
}
private struct CreateRoomRowButton: View {
var title: String
var image: String
var action: () -> Void
var body: some View {
HStack(spacing: 16) {
Image(systemName: image)
.foregroundColor(.Material.Elements.active)
Text(title)
.font(.body)
.foregroundColor(.Material.Text.main)
Spacer()
}
.sharedListRow()
.onTapGesture {
action()
}
}
}