From 4a81344a3a3de7e1ee70991a32b2a4f86e18c83d Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Thu, 13 Jun 2024 16:38:32 +0100 Subject: [PATCH] SF Symbol usage improvements --- Whisky/Views/Programs/ProgramMenuView.swift | 4 ++-- Whisky/Views/Programs/ProgramsView.swift | 25 ++++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Whisky/Views/Programs/ProgramMenuView.swift b/Whisky/Views/Programs/ProgramMenuView.swift index 9707627c3..4de5c1206 100644 --- a/Whisky/Views/Programs/ProgramMenuView.swift +++ b/Whisky/Views/Programs/ProgramMenuView.swift @@ -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) } } } diff --git a/Whisky/Views/Programs/ProgramsView.swift b/Whisky/Views/Programs/ProgramsView.swift index fb8148161..f92f91304 100644 --- a/Whisky/Views/Programs/ProgramsView.swift +++ b/Whisky/Views/Programs/ProgramsView.swift @@ -59,7 +59,8 @@ 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) @@ -67,7 +68,8 @@ struct ProgramsView: View { Button("program.add.blocklist", systemImage: "hand.raised") { bottle.settings.blocklist.append(program.url) blocklist = bottle.settings.blocklist - }.labelStyle(.titleAndIcon) + } + .labelStyle(.titleAndIcon) } } } @@ -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) } } } @@ -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) @@ -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")