Skip to content

Commit

Permalink
SF Symbol usage improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Jun 13, 2024
1 parent 3bd83a2 commit 4a81344
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Whisky/Views/Programs/ProgramMenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ struct ProgramMenuView: View {
? String(localized: "button.unpin")
: String(localized: "button.pin")

let iconName = program.pinned ? "pin.slash" : "pin"
Button(buttonName, systemImage: iconName) {
Button(buttonName, systemImage: "pin") {
program.pinned.toggle()
}
.labelStyle(.titleAndIcon)
.symbolVariant(program.pinned ? .slash : .none)
}
}
}
25 changes: 17 additions & 8 deletions Whisky/Views/Programs/ProgramsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ struct ProgramsView: View {
Button("program.add.selected.blocklist", systemImage: "hand.raised") {
bottle.settings.blocklist.append(contentsOf: selectedPrograms.map { $0.url })
blocklist = bottle.settings.blocklist
}.labelStyle(.titleAndIcon)
}
.labelStyle(.titleAndIcon)
} else {
ProgramMenuView(program: program, path: $path)

Section {
Button("program.add.blocklist", systemImage: "hand.raised") {
bottle.settings.blocklist.append(program.url)
blocklist = bottle.settings.blocklist
}.labelStyle(.titleAndIcon)
}
.labelStyle(.titleAndIcon)
}
}
}
Expand All @@ -82,15 +84,19 @@ struct ProgramsView: View {
)
.contextMenu {
if selectedBlockitems.contains(blockedUrl) {
Button("program.remove.selected.blocklist", systemImage: "hand.raised.slash") {
Button("program.remove.selected.blocklist", systemImage: "hand.raised") {
bottle.settings.blocklist.removeAll(where: { selectedBlockitems.contains($0) })
blocklist = bottle.settings.blocklist
}.labelStyle(.titleAndIcon)
}
.labelStyle(.titleAndIcon)
.symbolVariant(.slash)
} else {
Button("program.remove.blocklist", systemImage: "hand.raised.slash") {
Button("program.remove.blocklist", systemImage: "hand.raised") {
bottle.settings.blocklist.removeAll(where: { $0 == blockedUrl })
blocklist = bottle.settings.blocklist
}.labelStyle(.titleAndIcon)
}
.labelStyle(.titleAndIcon)
.symbolVariant(.slash)
}
}
}
Expand Down Expand Up @@ -140,10 +146,12 @@ struct ProgramItemView: View {
Button {
program.pinned.toggle()
} label: {
Image(systemName: program.pinned ? pinHovered ? "pin.slash.fill" : "pin.fill" : "pin")
Image(systemName: "pin")
.onHover { hover in
pinHovered = hover
}
.symbolVariant(program.pinned ? pinHovered ? .slash.fill : .fill : .none)
.contentTransition(.symbolEffect(.replace))
}
.buttonStyle(.plain)
.foregroundColor(program.pinned ? .accentColor : .secondary)
Expand Down Expand Up @@ -195,10 +203,11 @@ struct BlocklistItemView: View {
Text(blockedUrl.prettyPath(bottle))
Spacer()
if showButtons {
Button("program.remove.blocklist", systemImage: "xmark.circle.fill") {
Button("program.remove.blocklist", systemImage: "xmark.circle") {
bottle.settings.blocklist.removeAll { $0 == blockedUrl }
}
.labelStyle(.iconOnly)
.symbolVariant(.fill)
.buttonStyle(.plain)
.foregroundColor(.secondary)
.help("program.remove.blocklist")
Expand Down

0 comments on commit 4a81344

Please sign in to comment.