This commit is contained in:
fmodf 2024-08-06 14:14:00 +02:00
parent aea4330bca
commit 6006275690
2 changed files with 65 additions and 3 deletions

View file

@ -3,6 +3,8 @@ import SwiftUI
struct ChatsListScreen: View {
@EnvironmentObject var store: AppStore
@State private var isShowingAddScreen = false
var body: some View {
ZStack {
// Background color
@ -12,7 +14,7 @@ struct ChatsListScreen: View {
// Content
VStack(spacing: 0) {
// Header
ChatsScreenHeader()
ChatsScreenHeader(isShowingAddScreen: $isShowingAddScreen)
// Chats list
if !store.state.chatsState.chats.isEmpty {
@ -31,10 +33,16 @@ 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
@ -48,10 +56,10 @@ private struct ChatsScreenHeader: View {
HStack {
Spacer()
Image(systemName: "plus")
Image(systemName: "square.and.pencil")
.foregroundColor(.Material.Elements.active)
.tappablePadding(.symmetric(12)) {
print("Add contact")
isShowingAddScreen = true
}
}
.padding(.horizontal, 16)

View file

@ -0,0 +1,54 @@
import SwiftUI
struct CreateRoomScreen: View {
@EnvironmentObject var store: AppStore
@Environment(\.presentationMode) var presentationMode
var body: some View {
ZStack {
// Background color
Color.Material.Background.light
.ignoresSafeArea()
// Content
VStack(spacing: 0) {
// Header
CreateRoomScreenHeader(presentationMode: presentationMode)
// Create room form
// CreateRoomForm()
// Tab bar
Spacer()
Text("test")
}
}
}
}
private struct CreateRoomScreenHeader: View {
@Binding var presentationMode: PresentationMode
var body: some View {
ZStack {
// bg
Color.Material.Background.dark
.ignoresSafeArea()
HStack(spacing: 0) {
Image(systemName: "xmark")
.foregroundColor(.Material.Elements.active)
.padding(.trailing, 16)
.tappablePadding(.symmetric(12)) {
presentationMode.dismiss()
}
Spacer()
}
// title
Text("New")
.font(.head2)
.foregroundColor(Color.Material.Text.main)
}
}
}