Files
Termind/TFM/UI/Components/TranscriptProminentButtonStyle.swift
T

20 lines
651 B
Swift

import SwiftUI
private struct TranscriptProminentButtonModifier: ViewModifier {
@Environment(\.isEnabled) private var isEnabled
func body(content: Content) -> some View {
content
.buttonStyle(.borderedProminent)
// The enabled accent background needs its contrasting foreground.
// Disabled buttons have a neutral background instead.
.foregroundStyle(isEnabled ? TermindColor.transcriptProminentForeground : TermindColor.primaryForeground)
}
}
extension View {
func transcriptProminentButtonStyle() -> some View {
modifier(TranscriptProminentButtonModifier())
}
}