Files
bookstax/bookstax/Views/Shared/EmptyStateView.swift
T
2026-03-20 19:34:06 +01:00

37 lines
894 B
Swift

import SwiftUI
struct EmptyStateView: View {
let systemImage: String
let title: String
let message: String
var actionTitle: String? = nil
var action: (() -> Void)? = nil
var body: some View {
ContentUnavailableView(
label: {
Label(title, systemImage: systemImage)
},
description: {
Text(message)
},
actions: {
if let actionTitle, let action {
Button(actionTitle, action: action)
.buttonStyle(.borderedProminent)
}
}
)
}
}
#Preview {
EmptyStateView(
systemImage: "books.vertical",
title: "No Shelves",
message: "Your library is empty. Create a shelf in BookStack to get started.",
actionTitle: "Refresh",
action: {}
)
}