Parcourir la source

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 il y a 1 mois
Parent
commit
c35f324433
1 fichiers modifiés avec 17 ajouts et 2 suppressions
  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)
     }