feat: Adds more flagged view style options.

This commit is contained in:
2024-06-07 10:00:42 -04:00
parent 75fa3b55ae
commit 280cb3b863
8 changed files with 116 additions and 17 deletions

View File

@@ -0,0 +1,29 @@
import SharedModels
import Styleguide
import SwiftUI
/// Represents the status of a flagged value, which is stylable using the
/// `.flaggedStatusLabelStyle` modifier on a view.
///
/// By default the status label is colored using the default status color.
public struct FlaggedStatusLabel: View {
@Environment(\.flaggedStatusLabelStyle) private var style
let status: Flagged.CheckResult.Status
public init(status: Flagged.CheckResult.Status) {
self.status = status
}
public var body: some View {
TextLabel(status.title)
.textLabelStyle(
.colored(status.flagColor)
.combining(style)
)
}
}
#Preview {
FlaggedStatusLabel(status: .warning)
.flaggedStatusLabelStyle(.heavyTitle2)
}