feat: Adds more buttons and reverse label style
This commit is contained in:
24
Sources/Styleguide/Styles/ReverseLabelStyle.swift
Normal file
24
Sources/Styleguide/Styles/ReverseLabelStyle.swift
Normal file
@@ -0,0 +1,24 @@
|
||||
import SwiftUI
|
||||
|
||||
/// A label style that puts the title first and icon second.
|
||||
public struct ReverseLabelStyle: LabelStyle {
|
||||
let spacing: CGFloat
|
||||
|
||||
public init(spacing: CGFloat = 3) {
|
||||
self.spacing = spacing
|
||||
}
|
||||
|
||||
public func makeBody(configuration: Configuration) -> some View {
|
||||
HStack(spacing: spacing) {
|
||||
configuration.title
|
||||
configuration.icon
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension LabelStyle where Self == ReverseLabelStyle {
|
||||
|
||||
public static func reverse(spacing: CGFloat = 3) -> Self {
|
||||
.init(spacing: spacing)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user