浏览代码

Polish sidebar selection, Join with URL heading, and sidebar icons.

Use solid primary blue for the selected sidebar row with white labels, left-align section headers and full-width rows, add an underlined Join with URL tab with smaller type, and refresh Video and Settings sidebar glyphs for a cleaner white template look.

Made-with: Cursor
huzaifahayat12 2 周之前
父节点
当前提交
3d4da80cca

二进制
meetings_app/Assets.xcassets/SidebarSettingsLogo.imageset/sidebar_settings.png


二进制
meetings_app/Assets.xcassets/SidebarSettingsLogo.imageset/sidebar_settings@2x.png


二进制
meetings_app/Assets.xcassets/SidebarSettingsLogo.imageset/sidebar_settings@3x.png


二进制
meetings_app/Assets.xcassets/SidebarVideoLogo.imageset/sidebar_video.png


二进制
meetings_app/Assets.xcassets/SidebarVideoLogo.imageset/sidebar_video@2x.png


二进制
meetings_app/Assets.xcassets/SidebarVideoLogo.imageset/sidebar_video@3x.png


+ 47 - 10
meetings_app/ViewController.swift

@@ -82,6 +82,7 @@ private extension ViewController {
82 82
         let menuStack = NSStackView()
83 83
         menuStack.translatesAutoresizingMaskIntoConstraints = false
84 84
         menuStack.orientation = .vertical
85
+        menuStack.alignment = .leading
85 86
         menuStack.spacing = 10
86 87
 
87 88
         menuStack.addArrangedSubview(sidebarSectionTitle("Meetings"))
@@ -106,6 +107,10 @@ private extension ViewController {
106 107
             menuStack.topAnchor.constraint(equalTo: titleRow.bottomAnchor, constant: 20)
107 108
         ])
108 109
 
110
+        for subview in menuStack.arrangedSubviews {
111
+            subview.widthAnchor.constraint(equalTo: menuStack.widthAnchor).isActive = true
112
+        }
113
+
109 114
         return sidebar
110 115
     }
111 116
 
@@ -123,7 +128,7 @@ private extension ViewController {
123 128
 
124 129
         contentStack.addArrangedSubview(textLabel("Join Meetings", font: typography.pageTitle, color: palette.textPrimary))
125 130
         contentStack.addArrangedSubview(meetingTypeTabs())
126
-        contentStack.addArrangedSubview(textLabel("Join with URL", font: typography.sectionTitle, color: palette.textPrimary))
131
+        contentStack.addArrangedSubview(joinWithURLHeading())
127 132
         contentStack.addArrangedSubview(meetingUrlSection())
128 133
         contentStack.addArrangedSubview(scheduleHeader())
129 134
         contentStack.addArrangedSubview(textLabel("Tuesday, 14 Apr", font: typography.dateHeading, color: palette.textSecondary))
@@ -140,6 +145,39 @@ private extension ViewController {
140 145
         return panel
141 146
     }
142 147
 
148
+    func joinWithURLHeading() -> NSView {
149
+        let container = NSView()
150
+        container.translatesAutoresizingMaskIntoConstraints = false
151
+
152
+        let title = textLabel("Join with URL", font: typography.joinWithURLTitle, color: palette.textPrimary)
153
+        title.alignment = .left
154
+        title.setContentHuggingPriority(.defaultHigh, for: .horizontal)
155
+        title.setContentCompressionResistancePriority(.required, for: .horizontal)
156
+
157
+        let bar = NSView()
158
+        bar.translatesAutoresizingMaskIntoConstraints = false
159
+        bar.wantsLayer = true
160
+        bar.layer?.backgroundColor = palette.primaryBlue.cgColor
161
+        bar.heightAnchor.constraint(equalToConstant: 3).isActive = true
162
+
163
+        container.addSubview(title)
164
+        container.addSubview(bar)
165
+
166
+        NSLayoutConstraint.activate([
167
+            title.leadingAnchor.constraint(equalTo: container.leadingAnchor),
168
+            title.topAnchor.constraint(equalTo: container.topAnchor),
169
+
170
+            bar.leadingAnchor.constraint(equalTo: title.leadingAnchor),
171
+            bar.topAnchor.constraint(equalTo: title.bottomAnchor, constant: 6),
172
+            bar.widthAnchor.constraint(equalTo: title.widthAnchor),
173
+            bar.bottomAnchor.constraint(equalTo: container.bottomAnchor),
174
+
175
+            container.trailingAnchor.constraint(equalTo: title.trailingAnchor)
176
+        ])
177
+
178
+        return container
179
+    }
180
+
143 181
     func meetingTypeTabs() -> NSView {
144 182
         let wrapper = NSView()
145 183
         wrapper.translatesAutoresizingMaskIntoConstraints = false
@@ -362,18 +400,18 @@ private extension ViewController {
362 400
     }
363 401
 
364 402
     func sidebarSectionTitle(_ text: String) -> NSTextField {
365
-        textLabel(text, font: typography.sidebarSection, color: palette.textMuted)
403
+        let field = textLabel(text, font: typography.sidebarSection, color: palette.textMuted)
404
+        field.alignment = .left
405
+        return field
366 406
     }
367 407
 
368 408
     func sidebarItem(_ text: String, icon: String, selected: Bool, logoImageName: String? = nil, logoIconWidth: CGFloat = 18, logoHeightMultiplier: CGFloat = 1, logoTemplate: Bool = true) -> NSView {
369
-        let item = roundedContainer(cornerRadius: 9, color: selected ? palette.sidebarItemSelectedBackground : .clear)
409
+        let item = roundedContainer(cornerRadius: 10, color: selected ? palette.primaryBlue : .clear)
370 410
         item.translatesAutoresizingMaskIntoConstraints = false
371 411
         item.heightAnchor.constraint(equalToConstant: 36).isActive = true
372
-        if selected {
373
-            styleSurface(item, borderColor: palette.sidebarItemSelectedBorder, borderWidth: 1, shadow: false)
374
-        }
412
+        item.layer?.borderWidth = 0
375 413
 
376
-        let tint = selected ? palette.textPrimary : palette.textSecondary
414
+        let tint = selected ? NSColor.white : palette.textSecondary
377 415
         let leadingView: NSView
378 416
         if let name = logoImageName, let logo = NSImage(named: name) {
379 417
             let imageView = NSImageView(image: logo)
@@ -390,6 +428,7 @@ private extension ViewController {
390 428
         }
391 429
 
392 430
         let titleLabel = textLabel(text, font: typography.sidebarItem, color: tint)
431
+        titleLabel.alignment = .left
393 432
 
394 433
         item.addSubview(leadingView)
395 434
         item.addSubview(titleLabel)
@@ -501,8 +540,6 @@ private struct Palette {
501 540
     let inputBorder = NSColor(calibratedRed: 38.0 / 255.0, green: 40.0 / 255.0, blue: 44.0 / 255.0, alpha: 1)
502 541
     let primaryBlue = NSColor(calibratedRed: 27.0 / 255.0, green: 115.0 / 255.0, blue: 232.0 / 255.0, alpha: 1)
503 542
     let primaryBlueBorder = NSColor(calibratedRed: 42.0 / 255.0, green: 118.0 / 255.0, blue: 220.0 / 255.0, alpha: 1)
504
-    let sidebarItemSelectedBackground = NSColor(calibratedRed: 27.0 / 255.0, green: 115.0 / 255.0, blue: 232.0 / 255.0, alpha: 0.22)
505
-    let sidebarItemSelectedBorder = NSColor(calibratedRed: 55.0 / 255.0, green: 125.0 / 255.0, blue: 215.0 / 255.0, alpha: 0.55)
506 543
     let cancelButton = NSColor(calibratedRed: 20.0 / 255.0, green: 21.0 / 255.0, blue: 24.0 / 255.0, alpha: 1)
507 544
     let meetingBadge = NSColor(calibratedRed: 0.88, green: 0.66, blue: 0.14, alpha: 1)
508 545
     let separator = NSColor(calibratedRed: 26.0 / 255.0, green: 27.0 / 255.0, blue: 30.0 / 255.0, alpha: 1)
@@ -519,7 +556,7 @@ private struct Typography {
519 556
     let sidebarItem = NSFont.systemFont(ofSize: 16, weight: .medium)
520 557
 
521 558
     let pageTitle = NSFont.systemFont(ofSize: 27, weight: .semibold)
522
-    let sectionTitle = NSFont.systemFont(ofSize: 20, weight: .semibold)
559
+    let joinWithURLTitle = NSFont.systemFont(ofSize: 17, weight: .semibold)
523 560
     let sectionTitleBold = NSFont.systemFont(ofSize: 25, weight: .bold)
524 561
     let dateHeading = NSFont.systemFont(ofSize: 18, weight: .medium)
525 562