summaryrefslogtreecommitdiff
path: root/LearnMapKit/NetConfigView.swift
blob: 06fc5c2765859ee763abd61a1b1d9a6fc8feab1c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
//  NetConfigView.swift
//  LearnMapKit
//
//  Created by Jacky Jack on 19/07/2024.
//

import SwiftUI

struct NetConfigView: View {
    @State private var server_name: String = ""
    @State private var server_port: String = ""
    @Environment(\.dismissWindow) private var dismissWindow
    
    var body: some View {
        VStack {
            HStack {
                    Text("Server")
                    TextField("Server", text: $server_name)
            }
            HStack {
                    Text("Port")
                    TextField("Port", text: $server_port)
            }
            HStack {
                    Button(action:{
                        print("Cancel")
                        dismissWindow(id:"net-config")
                    }) {
                        Text("Cancel")
                    }
                    Button(action: {
                        print("Save config")
                        dismissWindow(id:"net-config")
                    }) {
                        Text("Save")
                    }
            }
        }
    }
}

#Preview {
    NetConfigView()
}