refactor: ProgressButton

This commit is contained in:
mrFq1
2023-05-23 23:19:29 +08:00
parent 088fc47329
commit 0a6ff05168
6 changed files with 115 additions and 87 deletions
@@ -42,24 +42,13 @@ struct RuleProvidersRowView: View {
}
}
} header: {
Button {
updateAll()
} label: {
HStack {
if isUpdating {
ProgressView()
.controlSize(.small)
.frame(width: 12)
} else {
Image(systemName: "arrow.clockwise")
.frame(width: 12)
}
Text(isUpdating ? "Updating" : "Update All")
.frame(width: 80)
ProgressButton(
title: "Update All",
title2: "Updating",
iconName: "arrow.clockwise",
inProgress: $isUpdating) {
updateAll()
}
.foregroundColor(isUpdating ? .gray : .blue)
}
.disabled(isUpdating)
}
.padding()
}