mirror of
https://github.com/home-assistant/iOS.git
synced 2026-04-16 20:49:48 -05: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. --> https://github.com/user-attachments/assets/3dcdf423-c302-4e30-84e3-433bba03bfa9 ## 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. -->
74 lines
2.2 KiB
Swift
74 lines
2.2 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 HACriticalButtonStyle: ButtonStyle {
|
|
public func makeBody(configuration: Configuration) -> some View {
|
|
configuration.label
|
|
.multilineTextAlignment(.center)
|
|
.font(.callout.bold())
|
|
.foregroundColor(.black)
|
|
.frame(maxWidth: .infinity)
|
|
.frame(height: 55)
|
|
.padding()
|
|
.background(.red.opacity(0.5))
|
|
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
.overlay(RoundedRectangle(cornerRadius: 12).stroke(Color.red, lineWidth: 1))
|
|
}
|
|
}
|
|
|
|
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()
|
|
}
|
|
}
|
|
|
|
public extension ButtonStyle where Self == HACriticalButtonStyle {
|
|
static var criticalButton: HACriticalButtonStyle {
|
|
HACriticalButtonStyle()
|
|
}
|
|
}
|