Procházet zdrojové kódy

Improve Quick Start pill button sizing and horizontal padding.

Give action buttons more breathing room while keeping the same text size so the labels look balanced and centered.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 před 1 měsícem
rodič
revize
c35f324433
1 změnil soubory, kde provedl 17 přidání a 2 odebrání
  1. 17 2
      smart_printer/UIComponents.swift

+ 17 - 2
smart_printer/UIComponents.swift

@@ -144,13 +144,15 @@ final class SidebarNavItem: NSControl {
 // MARK: - Action Button
 
 final class PillButton: NSButton {
+    private let horizontalPadding: CGFloat = 16
+
     init(title: String, color: NSColor) {
         super.init(frame: .zero)
         self.title = title
         isBordered = false
         wantsLayer = true
         layer?.backgroundColor = color.cgColor
-        layer?.cornerRadius = 10
+        layer?.cornerRadius = 11
         font = AppTheme.semiboldFont(size: 13)
         contentTintColor = .white
 
@@ -161,12 +163,25 @@ final class PillButton: NSButton {
             imageHugsTitle = true
         }
 
-        heightAnchor.constraint(equalToConstant: 36).isActive = true
+        heightAnchor.constraint(equalToConstant: 40).isActive = true
     }
 
     @available(*, unavailable)
     required init?(coder: NSCoder) { nil }
 
+    override var intrinsicContentSize: NSSize {
+        var size = super.intrinsicContentSize
+        size.width += horizontalPadding * 2
+        return size
+    }
+
+    override func draw(_ dirtyRect: NSRect) {
+        let originalBounds = bounds
+        defer { bounds = originalBounds }
+        bounds = originalBounds.insetBy(dx: horizontalPadding, dy: 0)
+        super.draw(dirtyRect)
+    }
+
     override func resetCursorRects() {
         addCursorRect(bounds, cursor: .pointingHand)
     }