//
//  NavigationPageView.swift
//  demo
//
//  Created by Jason on 2024/1/25.
//

import SwiftUI

struct NavigationPageView<T: View>: View {
    @Environment(\.presentationMode) private var presentationMode
    var title: String = ""
    var content: T?

    var body: some View {
        ScrollView {
            content
        }
        .navigationBarTitleDisplayMode(.inline)
        .navigationTitle(title)
        .navigationBarBackButtonHidden(true)
        .toolbar {
            ToolbarItem(placement: .navigationBarLeading) {
                Button {
                    presentationMode.wrappedValue.dismiss()
                } label: {
                    HStack {
                        Image(systemName: "chevron.backward")
                    }
                }
            }
        }
    }
}
