| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // TaskView.swift
- // Todos
- //
- // Created by Sam Jaffe on 2/28/26.
- //
- import SwiftUI
- struct SubTaskView: View {
- @Binding var task: SubTask
-
- @State private var showNotes: Bool = false
- @State private var hideNotes: Bool = false
- var body: some View {
- VStack {
- HStack {
- Picker("" /* TODO: Add Icons */, selection: $task.status) {
- ForEach(Status.allCases) { unit in
- Text(String(describing: unit))
- }
- }
- TextField("Task Name", text: $task.name)
- }
-
- if showNotes {
- HStack {
- TextField("Notes", text: $task.notes)
- .font(.footnote)
- .padding(.leading, 30)
- ShowHideTapper(shown: $showNotes, hideToggle: $hideNotes)
- }
- }
-
- }.onHover { yes in
- showNotes = yes || !(hideNotes || task.notes.isEmpty)
- }
- }
- }
- #Preview {
- @Previewable @State var task = SubTask(name: "New Task")
- SubTaskView(task: $task)
- .frame(minHeight: 100) // Preview does not resize window properly
- }
|