Update InstallButton with progress view and styling from list row

This commit is contained in:
Daniel Chick 2023-10-17 18:14:51 -05:00
parent 9cf10125ca
commit 13715930af

View file

@ -34,16 +34,26 @@ struct XcodeCommands: Commands {
struct InstallButton: View {
@EnvironmentObject var appState: AppState
@State private var isLoading = false
let xcode: Xcode?
var body: some View {
Button(action: install) {
Text("Install")
.help("Install")
}
if isLoading {
ProgressView()
.colorInvert()
.controlSize(.small)
} else {
Text("Install")
.textCase(.uppercase)
.help("InstallDescription")
}
}.buttonStyle(AppStoreButtonStyle(primary: false, highlighted: false))
}
private func install() {
isLoading = true
guard let xcode = xcode else { return }
appState.checkMinVersionAndInstall(id: xcode.id)
}