Prechádzať zdrojové kódy

Remove trailing arrow from Add new profile button

Drop the SF Symbol and showsTrailingArrow path from ProfilesPrimaryButton,
use symmetric horizontal padding for title-only layout, and remove
image-specific intrinsic width slack.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 2 mesiacov pred
rodič
commit
676cbbb9e6

+ 4 - 16
App for Indeed/Views/ProfilesListPageView.swift

@@ -31,7 +31,7 @@ final class ProfilesListPageView: NSView {
     private let documentView = ProfilesListDocumentView()
     private let contentStack = NSStackView()
     private let emptyStateLabel = NSTextField(wrappingLabelWithString: "")
-    private let addButton = ProfilesPrimaryButton(title: "Add new profile", showsTrailingArrow: true, target: nil, action: nil)
+    private let addButton = ProfilesPrimaryButton(title: "Add new profile", target: nil, action: nil)
 
     override var userInterfaceLayoutDirection: NSUserInterfaceLayoutDirection {
         get { .leftToRight }
@@ -256,8 +256,7 @@ private final class ProfileListRowView: NSView {
 // MARK: - Primary CTA (matches profile page button)
 
 private final class ProfilesPrimaryButton: NSButton {
-    /// Horizontal padding around title + icon. Extra trailing inset keeps the SF arrow off the capsule curve (`masksToBounds` can clip at the ends).
-    private static let intrinsicPadding = NSEdgeInsets(top: 12, left: 28, bottom: 12, right: 44)
+    private static let intrinsicPadding = NSEdgeInsets(top: 12, left: 28, bottom: 12, right: 28)
 
     private var trackingArea: NSTrackingArea?
     private var didPushCursor = false
@@ -272,17 +271,11 @@ private final class ProfilesPrimaryButton: NSButton {
         commonInit()
     }
 
-    convenience init(title: String, showsTrailingArrow: Bool = false, target: AnyObject?, action: Selector?) {
+    convenience init(title: String, target: AnyObject?, action: Selector?) {
         self.init(frame: .zero)
         self.title = title
         self.target = target
         self.action = action
-        if showsTrailingArrow {
-            imagePosition = .imageTrailing
-            let symbolConfig = NSImage.SymbolConfiguration(pointSize: 12, weight: .semibold)
-            image = NSImage(systemSymbolName: "arrow.right", accessibilityDescription: nil)?
-                .withSymbolConfiguration(symbolConfig)
-        }
     }
 
     private func commonInit() {
@@ -301,12 +294,7 @@ private final class ProfilesPrimaryButton: NSButton {
     override var intrinsicContentSize: NSSize {
         let base = super.intrinsicContentSize
         let p = Self.intrinsicPadding
-        // `NSButton` intrinsic width can sit a few points tight vs. the symbol’s painted bounds; add slack so the arrow never kisses the pill edge.
-        let trailingSlack: CGFloat = image != nil ? 10 : 0
-        return NSSize(
-            width: base.width + p.left + p.right + trailingSlack,
-            height: base.height + p.top + p.bottom
-        )
+        return NSSize(width: base.width + p.left + p.right, height: base.height + p.top + p.bottom)
     }
 
     override func layout() {