import SwiftUI

struct ListPopup: View {

    @Environment(\.dismiss)
    var dismiss

    let items: [String]

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