diff --git a/ConversationsClassic/View/Screens/ChatsListScreen.swift b/ConversationsClassic/View/Screens/ChatsListScreen.swift index 5c0e9f9..b0d0a12 100644 --- a/ConversationsClassic/View/Screens/ChatsListScreen.swift +++ b/ConversationsClassic/View/Screens/ChatsListScreen.swift @@ -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) diff --git a/ConversationsClassic/View/Screens/CreateRoomScreen.swift b/ConversationsClassic/View/Screens/CreateRoomScreen.swift new file mode 100644 index 0000000..c7b9079 --- /dev/null +++ b/ConversationsClassic/View/Screens/CreateRoomScreen.swift @@ -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) + } + } +}