import SwiftUI

// Add this view to a disposable sample app. This is not a test of your production app.
struct TransitionFixture: View {
    @State private var draft = ""
    @State private var selection = "None"
    @State private var confirmed = false

    var body: some View {
        NavigationStack {
            ScrollView {
                VStack(alignment: .leading, spacing: 20) {
                    Text("Transition fixture").font(.title)
                    Text("Type a draft, select an item, then change the available space.")
                    TextField("Draft", text: $draft)
                        .textFieldStyle(.roundedBorder)
                        .accessibilityIdentifier("draftField")
                    Button("Select item A") { selection = "Item A" }
                        .accessibilityIdentifier("selectItem")
                    Text(selection).accessibilityIdentifier("selectionValue")
                    NavigationLink("Open details") {
                        Text("Use the system Back button to return to your draft.")
                            .navigationTitle("Details")
                    }.accessibilityIdentifier("openDetails")
                    Button("Confirm transition review") { confirmed = true }
                        .accessibilityIdentifier("confirmTransition")
                    if confirmed {
                        Text("Transition confirmed").accessibilityIdentifier("transitionConfirmation")
                    }
                    Button("Submit draft") { }
                        .accessibilityIdentifier("primaryAction")
                }
                .padding()
                .frame(maxWidth: .infinity, alignment: .leading)
            }
            .navigationTitle("Draft")
        }
    }
}
