61 lines
1.7 KiB
Swift
61 lines
1.7 KiB
Swift
//
|
|
// ReshuffleNotificationView.swift
|
|
// Blackjack
|
|
//
|
|
// Shows a notification when the shoe is reshuffled.
|
|
//
|
|
|
|
import SwiftUI
|
|
import CasinoKit
|
|
|
|
/// Shows a notification when the shoe is reshuffled.
|
|
struct ReshuffleNotificationView: View {
|
|
let showCardCount: Bool
|
|
|
|
var body: some View {
|
|
HStack(spacing: Design.Spacing.small) {
|
|
Image(systemName: "shuffle")
|
|
.foregroundStyle(.white)
|
|
|
|
VStack(alignment: .leading, spacing: Design.Spacing.xxSmall) {
|
|
Text("Shoe Reshuffled")
|
|
.font(.system(size: Design.BaseFontSize.medium, weight: .bold))
|
|
.foregroundStyle(.white)
|
|
|
|
if showCardCount {
|
|
Text("Count reset to 0")
|
|
.font(.system(size: Design.BaseFontSize.small))
|
|
.foregroundStyle(.white.opacity(Design.Opacity.strong))
|
|
}
|
|
}
|
|
}
|
|
.padding(.horizontal, Design.Spacing.large)
|
|
.padding(.vertical, Design.Spacing.medium)
|
|
.background(
|
|
Capsule()
|
|
.fill(Color.blue.opacity(Design.Opacity.heavy))
|
|
)
|
|
.accessibilityElement(children: .ignore)
|
|
.accessibilityLabel(showCardCount
|
|
? String(localized: "Shoe reshuffled, count reset to zero")
|
|
: String(localized: "Shoe reshuffled"))
|
|
}
|
|
}
|
|
|
|
// MARK: - Previews
|
|
|
|
#Preview("Without Count") {
|
|
ZStack {
|
|
Color.Table.felt.ignoresSafeArea()
|
|
ReshuffleNotificationView(showCardCount: false)
|
|
}
|
|
}
|
|
|
|
#Preview("With Count Reset") {
|
|
ZStack {
|
|
Color.Table.felt.ignoresSafeArea()
|
|
ReshuffleNotificationView(showCardCount: true)
|
|
}
|
|
}
|
|
|