mirror of
https://github.com/home-assistant/iOS.git
synced 2026-02-20 10:51:54 -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 <!-- If this is a user-facing change not in the frontend, please include screenshots in light and dark mode. -->  ## Link to pull request in Documentation repository <!-- Pull requests that add, change or remove functionality must have a corresponding pull request in the Companion App Documentation repository (https://github.com/home-assistant/companion.home-assistant). Please add the number of this pull request after the "#" --> Documentation: home-assistant/companion.home-assistant# ## Any other notes <!-- If there is any other information of note, like if this Pull Request is part of a bigger change, please include it here. -->
53 lines
1.5 KiB
Swift
53 lines
1.5 KiB
Swift
import Foundation
|
|
import SwiftUI
|
|
|
|
public struct HAButtonStyle: ButtonStyle {
|
|
public func makeBody(configuration: Configuration) -> some View {
|
|
configuration.label
|
|
.font(.callout.bold())
|
|
.foregroundColor(.white)
|
|
.frame(maxWidth: .infinity)
|
|
.frame(height: 55)
|
|
.background(Color.asset(Asset.Colors.haPrimary))
|
|
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
}
|
|
}
|
|
|
|
public struct HASecondaryButtonStyle: ButtonStyle {
|
|
public func makeBody(configuration: Configuration) -> some View {
|
|
configuration.label
|
|
.font(.callout.bold())
|
|
.foregroundColor(Color.asset(Asset.Colors.haPrimary))
|
|
.frame(maxWidth: .infinity)
|
|
.frame(height: 55)
|
|
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
}
|
|
}
|
|
|
|
public struct HALinkButtonStyle: ButtonStyle {
|
|
public func makeBody(configuration: Configuration) -> some View {
|
|
configuration.label
|
|
.font(.footnote)
|
|
.foregroundColor(Color.asset(Asset.Colors.haPrimary))
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
}
|
|
|
|
public extension ButtonStyle where Self == HAButtonStyle {
|
|
static var primaryButton: HAButtonStyle {
|
|
HAButtonStyle()
|
|
}
|
|
}
|
|
|
|
public extension ButtonStyle where Self == HASecondaryButtonStyle {
|
|
static var secondaryButton: HASecondaryButtonStyle {
|
|
HASecondaryButtonStyle()
|
|
}
|
|
}
|
|
|
|
public extension ButtonStyle where Self == HALinkButtonStyle {
|
|
static var linkButton: HALinkButtonStyle {
|
|
HALinkButtonStyle()
|
|
}
|
|
}
|