| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- //
- // SubTaskView.swift
- // Todos
- //
- // Created by Sam Jaffe on 2/28/26.
- //
- import SwiftUI
- struct SubTaskView: View {
- @Binding var task: SubTask
- @State private var hideNotes: Bool = false
- @FocusState private var isFocused: Bool
- var body: some View {
- VStack {
- HStack {
- Label("", systemImage: "chevron.right")
- .padding(.trailing, -10)
- StatusPicker(status: $task.status)
- TextField("Task Name", text: $task.name)
- .focused($isFocused)
- }
- if isFocused || !(hideNotes || task.notes.isEmpty) {
- HStack {
- TextField("Notes", text: $task.notes)
- .font(.footnote)
- .padding(.leading, 30)
- VisibilityTapper(hideToggle: $hideNotes)
- }.focused($isFocused)
- }
- }
- }
- }
- #Preview {
- @Previewable @State var task = SubTask()
- SubTaskView(task: $task)
- .frame(minHeight: 100) // Preview does not resize window properly
- }
|