29 lines
676 B
Swift
29 lines
676 B
Swift
import SharedModels
|
|
import Styleguide
|
|
import SwiftUI
|
|
|
|
/// Represents the message of a flagged value result, which is stylable using the
|
|
/// `.flaggedMessageLabelStyle` modifier on a view.
|
|
///
|
|
/// By default the status label is colored using the default status color.
|
|
public struct FlaggedMessageLabel: View {
|
|
@Environment(\.flaggedMessageLabelStyle) private var style
|
|
let message: String?
|
|
|
|
public init(message: String?) {
|
|
self.message = message
|
|
}
|
|
|
|
public var body: some View {
|
|
if let message {
|
|
TextLabel(message)
|
|
.textLabelStyle(style)
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
FlaggedStatusLabel(status: .warning)
|
|
.flaggedStatusLabelStyle(.heavyTitle2)
|
|
}
|