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