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

Center and enlarge profile Save button

Pin the save action to the host with centerX, raise preferred width and
height, and lower horizontal hugging so layout can honor the wider frame.
Bump primary button typography and corner radius to match the larger control.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 недель назад: 3
Родитель
Сommit
3deb1bc9e8
1 измененных файлов с 9 добавлено и 5 удалено
  1. 9 5
      App for Indeed/Views/MyProfilePageView.swift

+ 9 - 5
App for Indeed/Views/MyProfilePageView.swift

@@ -861,17 +861,21 @@ final class MyProfilePageView: NSView {
861
 
861
 
862
     private func saveButtonHost() -> NSView {
862
     private func saveButtonHost() -> NSView {
863
         saveButton.translatesAutoresizingMaskIntoConstraints = false
863
         saveButton.translatesAutoresizingMaskIntoConstraints = false
864
+        saveButton.setContentHuggingPriority(.defaultLow, for: .horizontal)
864
         let host = NSView()
865
         let host = NSView()
865
         host.translatesAutoresizingMaskIntoConstraints = false
866
         host.translatesAutoresizingMaskIntoConstraints = false
866
         host.userInterfaceLayoutDirection = .leftToRight
867
         host.userInterfaceLayoutDirection = .leftToRight
867
         ProfileLayoutEnforcement.applyForcedLTR(to: host)
868
         ProfileLayoutEnforcement.applyForcedLTR(to: host)
868
         host.addSubview(saveButton)
869
         host.addSubview(saveButton)
870
+        let preferredWidth = saveButton.widthAnchor.constraint(equalToConstant: 292)
871
+        preferredWidth.priority = .defaultHigh
869
         NSLayoutConstraint.activate([
872
         NSLayoutConstraint.activate([
870
-            saveButton.leadingAnchor.constraint(equalTo: host.leadingAnchor),
873
+            saveButton.centerXAnchor.constraint(equalTo: host.centerXAnchor),
871
             saveButton.topAnchor.constraint(equalTo: host.topAnchor),
874
             saveButton.topAnchor.constraint(equalTo: host.topAnchor),
872
             saveButton.bottomAnchor.constraint(equalTo: host.bottomAnchor),
875
             saveButton.bottomAnchor.constraint(equalTo: host.bottomAnchor),
873
-            saveButton.heightAnchor.constraint(equalToConstant: 48),
874
-            saveButton.trailingAnchor.constraint(lessThanOrEqualTo: host.trailingAnchor)
876
+            saveButton.heightAnchor.constraint(equalToConstant: 54),
877
+            preferredWidth,
878
+            saveButton.widthAnchor.constraint(lessThanOrEqualTo: host.widthAnchor)
875
         ])
879
         ])
876
         return host
880
         return host
877
     }
881
     }
@@ -1320,10 +1324,10 @@ private final class ProfilePrimaryButton: NSButton {
1320
     private func commonInit() {
1324
     private func commonInit() {
1321
         bezelStyle = .rounded
1325
         bezelStyle = .rounded
1322
         isBordered = false
1326
         isBordered = false
1323
-        font = .systemFont(ofSize: 15, weight: .semibold)
1327
+        font = .systemFont(ofSize: 16, weight: .semibold)
1324
         contentTintColor = .white
1328
         contentTintColor = .white
1325
         wantsLayer = true
1329
         wantsLayer = true
1326
-        layer?.cornerRadius = 12
1330
+        layer?.cornerRadius = 14
1327
         if #available(macOS 11.0, *) {
1331
         if #available(macOS 11.0, *) {
1328
             layer?.cornerCurve = .continuous
1332
             layer?.cornerCurve = .continuous
1329
         }
1333
         }