Bladeren bron

Inset work and education entry cards with explicit constraints

Pin inner stack views with leading and trailing margins inside each work
and education entry card so fields align with the main profile form. Set
stack edge insets to NSEdgeInsets() because NSEdgeInsets has no .zero member
in AppKit.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 3 weken geleden
bovenliggende
commit
82a85daadf
1 gewijzigde bestanden met toevoegingen van 15 en 10 verwijderingen
  1. 15 10
      App for Indeed/Views/MyProfilePageView.swift

+ 15 - 10
App for Indeed/Views/MyProfilePageView.swift

@@ -883,6 +883,11 @@ final class MyProfilePageView: NSView {
883
 
883
 
884
 // MARK: - Work experience & education rows
884
 // MARK: - Work experience & education rows
885
 
885
 
886
+private enum ProfileEntryCardLayout {
887
+    /// Horizontal inset of fields inside each work/education entry card (matches main profile form).
888
+    static let horizontalInset: CGFloat = 28
889
+}
890
+
886
 private final class WorkExperienceEntryView: NSView {
891
 private final class WorkExperienceEntryView: NSView {
887
     var onDelete: (() -> Void)?
892
     var onDelete: (() -> Void)?
888
 
893
 
@@ -981,17 +986,17 @@ private final class WorkExperienceEntryView: NSView {
981
         inner.spacing = 16
986
         inner.spacing = 16
982
         inner.alignment = .leading
987
         inner.alignment = .leading
983
         inner.translatesAutoresizingMaskIntoConstraints = false
988
         inner.translatesAutoresizingMaskIntoConstraints = false
984
-        inner.edgeInsets = NSEdgeInsets(top: 16, left: 18, bottom: 16, right: 18)
989
+        inner.edgeInsets = NSEdgeInsets()
985
         inner.userInterfaceLayoutDirection = .leftToRight
990
         inner.userInterfaceLayoutDirection = .leftToRight
986
         ProfileLayoutEnforcement.applyForcedLTR(to: inner)
991
         ProfileLayoutEnforcement.applyForcedLTR(to: inner)
987
         inner.pinAllArrangedSubviewWidthsEqualToStackWidth()
992
         inner.pinAllArrangedSubviewWidthsEqualToStackWidth()
988
 
993
 
989
         addSubview(inner)
994
         addSubview(inner)
990
         NSLayoutConstraint.activate([
995
         NSLayoutConstraint.activate([
991
-            inner.leftAnchor.constraint(equalTo: leftAnchor),
992
-            inner.rightAnchor.constraint(equalTo: rightAnchor),
993
-            inner.topAnchor.constraint(equalTo: topAnchor),
994
-            inner.bottomAnchor.constraint(equalTo: bottomAnchor)
996
+            inner.leadingAnchor.constraint(equalTo: leadingAnchor, constant: ProfileEntryCardLayout.horizontalInset),
997
+            inner.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -ProfileEntryCardLayout.horizontalInset),
998
+            inner.topAnchor.constraint(equalTo: topAnchor, constant: 16),
999
+            inner.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -16)
995
         ])
1000
         ])
996
     }
1001
     }
997
 
1002
 
@@ -1255,17 +1260,17 @@ private final class EducationEntryView: NSView {
1255
         inner.spacing = 14
1260
         inner.spacing = 14
1256
         inner.alignment = .leading
1261
         inner.alignment = .leading
1257
         inner.translatesAutoresizingMaskIntoConstraints = false
1262
         inner.translatesAutoresizingMaskIntoConstraints = false
1258
-        inner.edgeInsets = NSEdgeInsets(top: 14, left: 18, bottom: 14, right: 18)
1263
+        inner.edgeInsets = NSEdgeInsets()
1259
         inner.userInterfaceLayoutDirection = .leftToRight
1264
         inner.userInterfaceLayoutDirection = .leftToRight
1260
         ProfileLayoutEnforcement.applyForcedLTR(to: inner)
1265
         ProfileLayoutEnforcement.applyForcedLTR(to: inner)
1261
         inner.pinAllArrangedSubviewWidthsEqualToStackWidth()
1266
         inner.pinAllArrangedSubviewWidthsEqualToStackWidth()
1262
 
1267
 
1263
         addSubview(inner)
1268
         addSubview(inner)
1264
         NSLayoutConstraint.activate([
1269
         NSLayoutConstraint.activate([
1265
-            inner.leftAnchor.constraint(equalTo: leftAnchor),
1266
-            inner.rightAnchor.constraint(equalTo: rightAnchor),
1267
-            inner.topAnchor.constraint(equalTo: topAnchor),
1268
-            inner.bottomAnchor.constraint(equalTo: bottomAnchor)
1270
+            inner.leadingAnchor.constraint(equalTo: leadingAnchor, constant: ProfileEntryCardLayout.horizontalInset),
1271
+            inner.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -ProfileEntryCardLayout.horizontalInset),
1272
+            inner.topAnchor.constraint(equalTo: topAnchor, constant: 14),
1273
+            inner.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -14)
1269
         ])
1274
         ])
1270
     }
1275
     }
1271
 
1276