CreateHintPopover.swift 817 B

12345678910111213141516171819202122232425262728293031323334
  1. //
  2. // CreateHintPopover.swift
  3. // Todos
  4. //
  5. // Created by Sam Jaffe on 3/1/26.
  6. //
  7. import SwiftUI
  8. struct CreateHintPopover: View {
  9. @Binding var showingPopup: Bool
  10. @EnvironmentObject var allHints: URLHintArray
  11. @State var currentHint: URLHint = URLHint()
  12. var body: some View {
  13. TextField("", text: $currentHint.prefix, prompt: Text("Tag Prefix"))
  14. TextField("", text: $currentHint.replacement, prompt: Text("URL Form"))
  15. HStack {
  16. Button(action: {
  17. currentHint = URLHint()
  18. showingPopup = false
  19. }) {
  20. Label("Cancel", systemImage: "x.circle")
  21. }
  22. Button(action: {
  23. allHints.array.append(currentHint)
  24. currentHint = URLHint()
  25. showingPopup = false
  26. }) {
  27. Label("Submit", systemImage: "checkmark.circle")
  28. }
  29. }
  30. }
  31. }