Skip to content

Commit

Permalink
Add role: .destructive, trash.fill -> trash
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed May 27, 2024
1 parent 898cef0 commit bf87a7b
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ struct ComplexModificationsAssetsView: View {

if assetFile.userFile {
Button(
role: .destructive,
action: {
assetFiles.removeFile(assetFile)
},
label: {
Image(systemName: "trash.fill")
Image(systemName: "trash")
.buttonLabelStyle()
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ struct ComplexModificationsView: View {
})

Button(
role: .destructive,
action: {
settings.removeComplexModificationsRule(complexModificationRule)
},
label: {
Image(systemName: "trash.fill")
Image(systemName: "trash")
.buttonLabelStyle()
}
)
Expand Down
1 change: 1 addition & 0 deletions src/apps/SettingsWindow/src/View/MiscView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ struct MiscView: View {

if settings.systemDefaultProfileExists {
Button(
role: .destructive,
action: {
settings.removeSystemDefaultProfile()
},
Expand Down
3 changes: 2 additions & 1 deletion src/apps/SettingsWindow/src/View/ProfilesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ struct ProfilesView: View {

if !profile.selected {
Button(
role: .destructive,
action: {
settings.removeProfile(profile)
},
label: {
Image(systemName: "trash.fill")
Image(systemName: "trash")
.buttonLabelStyle()
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,14 @@ struct SimpleModificationsView: View {
.padding(.trailing, 24.0)

Button(
role: .destructive,
action: {
LibKrbn.Settings.shared.removeSimpleModification(
index: simpleModification.index,
device: selectedDevice)
},
label: {
Image(systemName: "trash.fill")
Image(systemName: "trash")
.buttonLabelStyle()
}
)
Expand Down
1 change: 1 addition & 0 deletions src/apps/SettingsWindow/src/View/UninstallView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ struct UninstallView: View {
VStack(alignment: .leading, spacing: 12.0) {
HStack {
Button(
role: .destructive,
action: {
libkrbn_launch_uninstaller()

Expand Down
1 change: 1 addition & 0 deletions src/apps/share/swift/Views/Button+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import SwiftUI
// `.tint` and `.role` are available since macOS 12.0, so we cannot use it in order to support macOS 11.0.

extension Button {
// `role: .destructive` does not change the button color, so change the button color explicitly.
func deleteButtonStyle() -> some View {
// Do not put padding here.
// The padding area ignores click.
Expand Down

0 comments on commit bf87a7b

Please sign in to comment.