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