mirror of
https://github.com/home-assistant/iOS.git
synced 2026-02-04 02:46:35 -06:00
<!-- Thank you for submitting a Pull Request and helping to improve Home Assistant. Please complete the following sections to help the processing and review of your changes. Please do not delete anything from this template. --> ## Summary <!-- Provide a brief summary of the changes you have made and most importantly what they aim to achieve --> ## Screenshots 
33 lines
723 B
Swift
33 lines
723 B
Swift
import SwiftUI
|
|
|
|
public struct SettingsButton: View {
|
|
private let action: () -> Void
|
|
private let tint: Color
|
|
|
|
public init(tint: Color = Color.gray, action: @escaping (() -> Void)) {
|
|
self.action = action
|
|
self.tint = tint
|
|
}
|
|
|
|
public var body: some View {
|
|
Button(action: {
|
|
action()
|
|
}, label: {
|
|
Image(
|
|
uiImage: MaterialDesignIcons.cogIcon.image(
|
|
ofSize: .init(width: 25, height: 25), color: UIColor(tint)
|
|
)
|
|
)
|
|
})
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
VStack {
|
|
SettingsButton {}
|
|
.frame(maxWidth: .infinity, alignment: .trailing)
|
|
.padding()
|
|
Spacer()
|
|
}
|
|
}
|