Преглед изворни кода

Match Add new profile button to job card Apply styling.

Use the same 13pt semibold label, 32pt height, and 8pt corners as Apply/Saved CTAs instead of the oversized pill.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 пре 3 недеља
родитељ
комит
07de939cd6
1 измењених фајлова са 12 додато и 17 уклоњено
  1. 12 17
      App for Indeed/Views/ProfilesListPageView.swift

+ 12 - 17
App for Indeed/Views/ProfilesListPageView.swift

@@ -108,9 +108,12 @@ final class ProfilesListPageView: NSView {
108
         addButton.target = self
108
         addButton.target = self
109
         addButton.action = #selector(didTapAdd)
109
         addButton.action = #selector(didTapAdd)
110
         addButton.translatesAutoresizingMaskIntoConstraints = false
110
         addButton.translatesAutoresizingMaskIntoConstraints = false
111
-        // Keep the pill at intrinsic width so title + arrow stay grouped and centered; otherwise a wide stack pins text and icon to opposite edges.
112
         addButton.setContentHuggingPriority(.required, for: .horizontal)
111
         addButton.setContentHuggingPriority(.required, for: .horizontal)
113
         addButton.setContentCompressionResistancePriority(.required, for: .horizontal)
112
         addButton.setContentCompressionResistancePriority(.required, for: .horizontal)
113
+        NSLayoutConstraint.activate([
114
+            addButton.heightAnchor.constraint(equalToConstant: 32),
115
+            addButton.widthAnchor.constraint(greaterThanOrEqualToConstant: 76)
116
+        ])
114
 
117
 
115
         let titleSubtitleStack = NSStackView(views: [title, subtitle])
118
         let titleSubtitleStack = NSStackView(views: [title, subtitle])
116
         titleSubtitleStack.orientation = .vertical
119
         titleSubtitleStack.orientation = .vertical
@@ -299,10 +302,10 @@ private final class ProfileListRowView: NSView {
299
     }
302
     }
300
 }
303
 }
301
 
304
 
302
-// MARK: - Primary CTA (matches profile page button)
305
+// MARK: - Primary CTA (matches job cards’ Apply: 13pt semibold, 32pt tall, 8pt corners)
303
 
306
 
304
 private final class ProfilesPrimaryButton: NSButton {
307
 private final class ProfilesPrimaryButton: NSButton {
305
-    private static let intrinsicPadding = NSEdgeInsets(top: 12, left: 28, bottom: 12, right: 28)
308
+    private static let horizontalOutset: CGFloat = 20
306
 
309
 
307
     private var trackingArea: NSTrackingArea?
310
     private var trackingArea: NSTrackingArea?
308
     private var didPushCursor = false
311
     private var didPushCursor = false
@@ -325,29 +328,21 @@ private final class ProfilesPrimaryButton: NSButton {
325
     }
328
     }
326
 
329
 
327
     private func commonInit() {
330
     private func commonInit() {
331
+        translatesAutoresizingMaskIntoConstraints = false
328
         bezelStyle = .rounded
332
         bezelStyle = .rounded
329
         isBordered = false
333
         isBordered = false
330
-        font = .systemFont(ofSize: 15, weight: .semibold)
334
+        font = .systemFont(ofSize: 13, weight: .semibold)
331
         contentTintColor = .white
335
         contentTintColor = .white
336
+        focusRingType = .none
332
         wantsLayer = true
337
         wantsLayer = true
333
-        layer?.masksToBounds = true
334
-        if #available(macOS 11.0, *) {
335
-            layer?.cornerCurve = .continuous
336
-        }
338
+        layer?.cornerRadius = 8
337
         layer?.backgroundColor = ProfilesListPalette.brandBlue.cgColor
339
         layer?.backgroundColor = ProfilesListPalette.brandBlue.cgColor
338
     }
340
     }
339
 
341
 
340
     override var intrinsicContentSize: NSSize {
342
     override var intrinsicContentSize: NSSize {
341
         let base = super.intrinsicContentSize
343
         let base = super.intrinsicContentSize
342
-        let p = Self.intrinsicPadding
343
-        return NSSize(width: base.width + p.left + p.right, height: base.height + p.top + p.bottom)
344
-    }
345
-
346
-    override func layout() {
347
-        super.layout()
348
-        let h = bounds.height
349
-        guard h > 1 else { return }
350
-        layer?.cornerRadius = h / 2
344
+        guard base.width != NSView.noIntrinsicMetric, base.width >= 1 else { return base }
345
+        return NSSize(width: base.width + Self.horizontalOutset, height: base.height)
351
     }
346
     }
352
 
347
 
353
     override func updateTrackingAreas() {
348
     override func updateTrackingAreas() {