Improve password list view
This commit is contained in:
parent
55ace80869
commit
949292060b
2 changed files with 77 additions and 3 deletions
51
password/view/add/AddView.swift
Normal file
51
password/view/add/AddView.swift
Normal file
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// AddView.swift
|
||||
// password
|
||||
//
|
||||
// Created by Markus Thielker on 16.01.25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct AddPasswordView: View {
|
||||
|
||||
@ObservedObject var viewModel: ListViewModel
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
@State private var name: String = ""
|
||||
@State private var value: String = ""
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
VStack {
|
||||
Text("Add Password")
|
||||
.font(.headline)
|
||||
Text("Create a new password to learn. It will be encrypted and stored securely.")
|
||||
}
|
||||
.padding(EdgeInsets(top: 0, leading: 0, bottom: 10, trailing: 0))
|
||||
Form {
|
||||
TextField("Name", text: $name)
|
||||
TextField("Value", text: $value)
|
||||
Text("The password will not be visible again later. Make sure to save it somewhere else too!")
|
||||
.font(.footnote)
|
||||
HStack {
|
||||
Button("Save") {
|
||||
viewModel.savePassword(name: name, value: value)
|
||||
name = ""
|
||||
value = ""
|
||||
dismiss()
|
||||
}
|
||||
Button("Cancel") {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
.padding(EdgeInsets(top: 10, leading: 0, bottom: 0, trailing: 0))
|
||||
}
|
||||
}.padding(20)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
AddPasswordView(viewModel: .init())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue