feat: Adds more flagged view style options.
This commit is contained in:
28
Sources/FlaggedViews/FlaggedMessageLabel.swift
Normal file
28
Sources/FlaggedViews/FlaggedMessageLabel.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user