Просмотр исходного кода

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
Родитель
Сommit
676cbbb9e6
1 измененных файлов с 4 добавлено и 16 удалено
  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
     private let documentView = ProfilesListDocumentView()
31
     private let documentView = ProfilesListDocumentView()
32
     private let contentStack = NSStackView()
32
     private let contentStack = NSStackView()
33
     private let emptyStateLabel = NSTextField(wrappingLabelWithString: "")
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
     override var userInterfaceLayoutDirection: NSUserInterfaceLayoutDirection {
36
     override var userInterfaceLayoutDirection: NSUserInterfaceLayoutDirection {
37
         get { .leftToRight }
37
         get { .leftToRight }
@@ -256,8 +256,7 @@ private final class ProfileListRowView: NSView {
256
 // MARK: - Primary CTA (matches profile page button)
256
 // MARK: - Primary CTA (matches profile page button)
257
 
257
 
258
 private final class ProfilesPrimaryButton: NSButton {
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
     private var trackingArea: NSTrackingArea?
261
     private var trackingArea: NSTrackingArea?
263
     private var didPushCursor = false
262
     private var didPushCursor = false
@@ -272,17 +271,11 @@ private final class ProfilesPrimaryButton: NSButton {
272
         commonInit()
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
         self.init(frame: .zero)
275
         self.init(frame: .zero)
277
         self.title = title
276
         self.title = title
278
         self.target = target
277
         self.target = target
279
         self.action = action
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
     private func commonInit() {
281
     private func commonInit() {
@@ -301,12 +294,7 @@ private final class ProfilesPrimaryButton: NSButton {
301
     override var intrinsicContentSize: NSSize {
294
     override var intrinsicContentSize: NSSize {
302
         let base = super.intrinsicContentSize
295
         let base = super.intrinsicContentSize
303
         let p = Self.intrinsicPadding
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
     override func layout() {
300
     override func layout() {