| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- // LoopFollow
- // InfoBanner.swift
- // Created by Jonas Björkert on 2025-05-10.
- import SwiftUI
- struct InfoBanner: View {
- /// Main explanatory text
- let text: String
- /// Optional alarm type whose icon you’d like to show.
- /// If `nil`, we fall back to the standard “info” symbol.
- var alarmType: AlarmType? = nil
- /// Colour for the leading symbol
- var iconColour: Color = .accentColor
- /// Background + border tints
- var tint: Color = Color.blue.opacity(0.20)
- var border: Color = Color.blue.opacity(0.40)
- // ────────── View ──────────
- var body: some View {
- HStack(alignment: .top, spacing: 12) {
- Image(systemName: alarmType?.icon ?? "info.circle.fill")
- .font(.title3)
- .foregroundColor(iconColour)
- Text(text)
- .font(.callout)
- .fixedSize(horizontal: false, vertical: true)
- }
- .padding()
- .frame(maxWidth: .infinity, alignment: .leading)
- .background(
- RoundedRectangle(cornerRadius: 12, style: .continuous)
- .fill(tint)
- )
- .overlay(
- RoundedRectangle(cornerRadius: 12, style: .continuous)
- .stroke(border, lineWidth: 1)
- )
- .listRowInsets(EdgeInsets())
- }
- }
|