| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // TaskView.swift
- // Todos
- //
- // Created by Sam Jaffe on 2/28/26.
- //
- import SwiftUI
- struct TaskView: View {
- @Binding var task: Task
- @State private var showTags: Bool = false
- @State private 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 showTags {
- TagBarView(tags: $task.tags)
- .font(.footnote)
- .padding(.leading, 30)
- }
- if showNotes {
- TextField("Notes", text: $task.notes)
- .font(.footnote)
- .padding(.leading, 30)
- }
- }.onHover { yes in
- showTags = yes || !task.tags.isEmpty
- showNotes = yes || !task.notes.isEmpty
- }
- }
- }
- #Preview {
- @Previewable @State var task = Task(name: "New Task")
- TaskView(task: $task)
- .frame(minHeight: 100) // Preview does not resize window properly
- }
|