iOS/Sources/Shared/DesignSystem/Styles/HAButtonStyles.swift
Bruno Pantaleão Gonçalves f52351e4c9
Add bluetooth permission screen (#3104)
<!-- 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. -->
![CleanShot 2024-10-29 at 16 16
18@2x](https://github.com/user-attachments/assets/76421e5e-6dc6-4405-955d-c90e003dceaf)
## 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. -->
2024-10-29 17:35:26 +01:00

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()
}
}