refactor: centralize font-relative UI icon sizing

This commit is contained in:
Valdemar Lorenzen
2026-10-15 13:16:12 +02:00
parent db8150c312
commit 6a7a0eb0ab
8 changed files with 124 additions and 46 deletions
@@ -88,7 +88,7 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
back.target = self
back.action = #selector(goBack)
back.title = ""
back.image = NSImage(systemSymbolName: "chevron.left", accessibilityDescription: nil)
back.image = IconStyle.symbol("chevron.left", for: search.font!)
back.imageScaling = .scaleProportionallyDown
back.isBordered = false
back.contentTintColor = SunsetPalette.secondaryText
@@ -429,11 +429,13 @@ private final class UninstallFileCell: NSTableCellView {
let name = NSTextField(labelWithString: "")
let detail = NSTextField(labelWithString: "")
let size = NSTextField(labelWithString: "")
let fileIcon = NSImageView()
let fileIcon: IconView
init() {
let font = NSFont.systemFont(ofSize: 14, weight: .medium)
fileIcon = IconView(font: font)
super.init(frame: .zero)
name.font = .systemFont(ofSize: 14, weight: .medium)
name.font = font
detail.font = .systemFont(ofSize: 11)
detail.textColor = SunsetPalette.secondaryText
for label in [name, detail] {
@@ -447,7 +449,6 @@ private final class UninstallFileCell: NSTableCellView {
size.textColor = SunsetPalette.secondaryText
size.font = .systemFont(ofSize: 12)
size.setContentCompressionResistancePriority(.required, for: .horizontal)
fileIcon.imageScaling = .scaleProportionallyDown
let row = NSStackView(views: [toggle, labels, NSView(), size, fileIcon])
row.orientation = .horizontal
row.alignment = .centerY
@@ -458,9 +459,7 @@ private final class UninstallFileCell: NSTableCellView {
row.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 8),
row.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -8),
row.topAnchor.constraint(equalTo: topAnchor, constant: 4),
row.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -4),
fileIcon.widthAnchor.constraint(equalToConstant: 22),
fileIcon.heightAnchor.constraint(equalToConstant: 22)
row.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -4)
])
}