feat: Adds more flagged view style options.
This commit is contained in:
24
Sources/FlaggedViews/Styles/FlaggedStatusLabelStyle.swift
Normal file
24
Sources/FlaggedViews/Styles/FlaggedStatusLabelStyle.swift
Normal file
@@ -0,0 +1,24 @@
|
||||
import SharedModels
|
||||
import Styleguide
|
||||
import SwiftUI
|
||||
|
||||
private struct FlaggedStatusLabelStyleKey: EnvironmentKey {
|
||||
static var defaultValue = AnyTextLabelStyle(style: .font(.caption, fontWeight: .bold))
|
||||
}
|
||||
|
||||
extension EnvironmentValues {
|
||||
public var flaggedStatusLabelStyle: AnyTextLabelStyle {
|
||||
get { self[FlaggedStatusLabelStyleKey.self] }
|
||||
set { self[FlaggedStatusLabelStyleKey.self] = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
public func flaggedStatusLabelStyle(_ style: AnyTextLabelStyle) -> some View {
|
||||
environment(\.flaggedStatusLabelStyle, style)
|
||||
}
|
||||
|
||||
public func flaggedStatusLabelStyle<S: TextLabelStyle>(_ style: S) -> some View {
|
||||
flaggedStatusLabelStyle(AnyTextLabelStyle(style: style))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user