import SwiftUI

struct ListPopup: View {

    @Environment(\.dismiss)
    var dismiss

    let title: LocalizedStringKey

    let items: [String]

    var body: some View {
        VStack {
            Text(title)
                .font(.title)
            List {
                ForEach(items, id: \.self) { page in
                    Text(page)
                }
            }
            .frame(minHeight: min(CGFloat(items.count) * 31, 500))
            Button("Dismiss") { dismiss() }
        }
        .padding(.vertical)
        .onTapGesture {
            dismiss()
        }
    }
}
