Kaynağa Gözat

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 3 hafta önce
ebeveyn
işleme
676cbbb9e6
1 değiştirilmiş dosya ile 4 ekleme ve 16 silme
  1. 4 16
      App for Indeed/Views/ProfilesListPageView.swift

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

@@ -31,7 +31,7 @@ final class ProfilesListPageView: NSView {
31 31
     private let documentView = ProfilesListDocumentView()
32 32
     private let contentStack = NSStackView()
33 33
     private let emptyStateLabel = NSTextField(wrappingLabelWithString: "")
34
-    private let addButton = ProfilesPrimaryButton(title: "Add new profile", showsTrailingArrow: true, target: nil, action: nil)
34
+    private let addButton = ProfilesPrimaryButton(title: "Add new profile", target: nil, action: nil)
35 35
 
36 36
     override var userInterfaceLayoutDirection: NSUserInterfaceLayoutDirection {
37 37
         get { .leftToRight }
@@ -256,8 +256,7 @@ private final class ProfileListRowView: NSView {
256 256
 // MARK: - Primary CTA (matches profile page button)
257 257
 
258 258
 private final class ProfilesPrimaryButton: NSButton {
259
-    /// Horizontal padding around title + icon. Extra trailing inset keeps the SF arrow off the capsule curve (`masksToBounds` can clip at the ends).
260
-    private static let intrinsicPadding = NSEdgeInsets(top: 12, left: 28, bottom: 12, right: 44)
259
+    private static let intrinsicPadding = NSEdgeInsets(top: 12, left: 28, bottom: 12, right: 28)
261 260
 
262 261
     private var trackingArea: NSTrackingArea?
263 262
     private var didPushCursor = false
@@ -272,17 +271,11 @@ private final class ProfilesPrimaryButton: NSButton {
272 271
         commonInit()
273 272
     }
274 273
 
275
-    convenience init(title: String, showsTrailingArrow: Bool = false, target: AnyObject?, action: Selector?) {
274
+    convenience init(title: String, target: AnyObject?, action: Selector?) {
276 275
         self.init(frame: .zero)
277 276
         self.title = title
278 277
         self.target = target
279 278
         self.action = action
280
-        if showsTrailingArrow {
281
-            imagePosition = .imageTrailing
282
-            let symbolConfig = NSImage.SymbolConfiguration(pointSize: 12, weight: .semibold)
283
-            image = NSImage(systemSymbolName: "arrow.right", accessibilityDescription: nil)?
284
-                .withSymbolConfiguration(symbolConfig)
285
-        }
286 279
     }
287 280
 
288 281
     private func commonInit() {
@@ -301,12 +294,7 @@ private final class ProfilesPrimaryButton: NSButton {
301 294
     override var intrinsicContentSize: NSSize {
302 295
         let base = super.intrinsicContentSize
303 296
         let p = Self.intrinsicPadding
304
-        // `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.
305
-        let trailingSlack: CGFloat = image != nil ? 10 : 0
306
-        return NSSize(
307
-            width: base.width + p.left + p.right + trailingSlack,
308
-            height: base.height + p.top + p.bottom
309
-        )
297
+        return NSSize(width: base.width + p.left + p.right, height: base.height + p.top + p.bottom)
310 298
     }
311 299
 
312 300
     override func layout() {