ソースを参照

Fix CV maker group toggle resizing on selection

Use fillEqually on the group tabs stack and relax pillLarge chip
horizontal hugging so Design-Based and Profession-Based stay equal
width. Center the inner icon/label/badge stack in large pills.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 2 ヶ月 前
コミット
04186498f9
1 ファイル変更19 行追加6 行削除
  1. 19 6
      App for Indeed/Views/CVMakerPageView.swift

+ 19 - 6
App for Indeed/Views/CVMakerPageView.swift

@@ -607,6 +607,7 @@ final class CVMakerPageView: NSView {
         groupTabsRow.orientation = .horizontal
         groupTabsRow.spacing = 8
         groupTabsRow.alignment = .centerY
+        groupTabsRow.distribution = .fillEqually
         groupTabsRow.translatesAutoresizingMaskIntoConstraints = false
         configureGroupTabs()
 
@@ -1051,12 +1052,24 @@ private final class CVChipButton: NSView {
 
         addSubview(stack)
         let horizontalInset: CGFloat = style == .pillLarge ? 16 : 12
-        NSLayoutConstraint.activate([
-            stack.leadingAnchor.constraint(equalTo: leadingAnchor, constant: horizontalInset),
-            stack.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -horizontalInset),
-            stack.centerYAnchor.constraint(equalTo: centerYAnchor)
-        ])
-        setContentHuggingPriority(.required, for: .horizontal)
+        if style == .pillLarge {
+            // Group toggle shares a row: equal widths from the parent stack; keep
+            // icon + label + badge centered so selection state does not reshuffle width.
+            NSLayoutConstraint.activate([
+                stack.centerXAnchor.constraint(equalTo: centerXAnchor),
+                stack.leadingAnchor.constraint(greaterThanOrEqualTo: leadingAnchor, constant: horizontalInset),
+                stack.trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor, constant: -horizontalInset),
+                stack.centerYAnchor.constraint(equalTo: centerYAnchor)
+            ])
+            setContentHuggingPriority(.defaultLow, for: .horizontal)
+        } else {
+            NSLayoutConstraint.activate([
+                stack.leadingAnchor.constraint(equalTo: leadingAnchor, constant: horizontalInset),
+                stack.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -horizontalInset),
+                stack.centerYAnchor.constraint(equalTo: centerYAnchor)
+            ])
+            setContentHuggingPriority(.required, for: .horizontal)
+        }
         applyState()
     }