Ver código fonte

Tighten schedule cards layout and size.

Use fixed-width cards with left-aligned rows, smaller typography, and adjustable height with extra bottom space so the schedule section matches the compact reference layout.

Made-with: Cursor
huzaifahayat12 2 semanas atrás
pai
commit
216ce39fee
1 arquivos alterados com 29 adições e 26 exclusões
  1. 29 26
      meetings_app/ViewController.swift

+ 29 - 26
meetings_app/ViewController.swift

@@ -307,11 +307,11 @@ private extension ViewController {
307 307
         let row = NSStackView()
308 308
         row.translatesAutoresizingMaskIntoConstraints = false
309 309
         row.orientation = .horizontal
310
-        row.spacing = 14
310
+        row.spacing = 10
311 311
         row.alignment = .top
312
-        row.distribution = .fillEqually
313
-        row.widthAnchor.constraint(greaterThanOrEqualToConstant: 780).isActive = true
314
-        row.heightAnchor.constraint(equalToConstant: 168).isActive = true
312
+        row.distribution = .fill
313
+        row.setContentHuggingPriority(.defaultHigh, for: .horizontal)
314
+        row.heightAnchor.constraint(equalToConstant: 136).isActive = true
315 315
 
316 316
         row.addArrangedSubview(scheduleCard())
317 317
         row.addArrangedSubview(scheduleCard())
@@ -319,15 +319,18 @@ private extension ViewController {
319 319
     }
320 320
 
321 321
     func scheduleCard() -> NSView {
322
-        let card = roundedContainer(cornerRadius: 12, color: palette.sectionCard)
322
+        let cardWidth: CGFloat = 264
323
+
324
+        let card = roundedContainer(cornerRadius: 10, color: palette.sectionCard)
323 325
         styleSurface(card, borderColor: palette.inputBorder, borderWidth: 1, shadow: true)
324 326
         card.translatesAutoresizingMaskIntoConstraints = false
325
-        card.heightAnchor.constraint(equalToConstant: 168).isActive = true
327
+        card.widthAnchor.constraint(equalToConstant: cardWidth).isActive = true
328
+        card.heightAnchor.constraint(equalToConstant: 136).isActive = true
326 329
 
327
-        let icon = roundedContainer(cornerRadius: 7, color: palette.meetingBadge)
330
+        let icon = roundedContainer(cornerRadius: 5, color: palette.meetingBadge)
328 331
         icon.translatesAutoresizingMaskIntoConstraints = false
329
-        icon.widthAnchor.constraint(equalToConstant: 30).isActive = true
330
-        icon.heightAnchor.constraint(equalToConstant: 30).isActive = true
332
+        icon.widthAnchor.constraint(equalToConstant: 22).isActive = true
333
+        icon.heightAnchor.constraint(equalToConstant: 22).isActive = true
331 334
         let iconText = textLabel("••", font: typography.cardIcon, color: .white)
332 335
         iconText.translatesAutoresizingMaskIntoConstraints = false
333 336
         icon.addSubview(iconText)
@@ -337,8 +340,8 @@ private extension ViewController {
337 340
         ])
338 341
 
339 342
         let title = textLabel("General Meeting", font: typography.cardTitle, color: palette.textPrimary)
340
-        let subtitle = textLabel("Baisakhi", font: typography.cardSubtitle, color: palette.textSecondary)
341
-        let time = textLabel("12:00 AM - 11:59 PM", font: typography.cardTime, color: palette.textTertiary)
343
+        let subtitle = textLabel("Baisakhi", font: typography.cardSubtitle, color: palette.textPrimary)
344
+        let time = textLabel("12:00 AM - 11:59 PM", font: typography.cardTime, color: palette.textSecondary)
342 345
 
343 346
         card.addSubview(icon)
344 347
         card.addSubview(title)
@@ -346,18 +349,18 @@ private extension ViewController {
346 349
         card.addSubview(time)
347 350
 
348 351
         NSLayoutConstraint.activate([
349
-            icon.leadingAnchor.constraint(equalTo: card.leadingAnchor, constant: 14),
350
-            icon.topAnchor.constraint(equalTo: card.topAnchor, constant: 14),
352
+            icon.leadingAnchor.constraint(equalTo: card.leadingAnchor, constant: 10),
353
+            icon.topAnchor.constraint(equalTo: card.topAnchor, constant: 10),
351 354
 
352
-            title.leadingAnchor.constraint(equalTo: icon.trailingAnchor, constant: 8),
355
+            title.leadingAnchor.constraint(equalTo: icon.trailingAnchor, constant: 6),
353 356
             title.centerYAnchor.constraint(equalTo: icon.centerYAnchor),
354
-            title.trailingAnchor.constraint(lessThanOrEqualTo: card.trailingAnchor, constant: -12),
357
+            title.trailingAnchor.constraint(lessThanOrEqualTo: card.trailingAnchor, constant: -10),
355 358
 
356
-            subtitle.leadingAnchor.constraint(equalTo: card.leadingAnchor, constant: 14),
357
-            subtitle.topAnchor.constraint(equalTo: icon.bottomAnchor, constant: 12),
359
+            subtitle.leadingAnchor.constraint(equalTo: card.leadingAnchor, constant: 10),
360
+            subtitle.topAnchor.constraint(equalTo: icon.bottomAnchor, constant: 7),
358 361
 
359
-            time.leadingAnchor.constraint(equalTo: card.leadingAnchor, constant: 14),
360
-            time.topAnchor.constraint(equalTo: subtitle.bottomAnchor, constant: 8)
362
+            time.leadingAnchor.constraint(equalTo: card.leadingAnchor, constant: 10),
363
+            time.topAnchor.constraint(equalTo: subtitle.bottomAnchor, constant: 4)
361 364
         ])
362 365
 
363 366
         return card
@@ -378,9 +381,9 @@ private extension ViewController {
378 381
         view.layer?.borderWidth = borderWidth
379 382
         if shadow {
380 383
             view.layer?.shadowColor = NSColor.black.cgColor
381
-            view.layer?.shadowOpacity = 0.22
382
-            view.layer?.shadowOffset = CGSize(width: 0, height: -2)
383
-            view.layer?.shadowRadius = 8
384
+            view.layer?.shadowOpacity = 0.18
385
+            view.layer?.shadowOffset = CGSize(width: 0, height: -1)
386
+            view.layer?.shadowRadius = 5
384 387
         }
385 388
     }
386 389
 
@@ -570,9 +573,9 @@ private struct Typography {
570 573
     let filterArrow = NSFont.systemFont(ofSize: 12, weight: .regular)
571 574
     let iconButton = NSFont.systemFont(ofSize: 14, weight: .medium)
572 575
 
573
-    let cardIcon = NSFont.systemFont(ofSize: 10, weight: .bold)
574
-    let cardTitle = NSFont.systemFont(ofSize: 23, weight: .semibold)
575
-    let cardSubtitle = NSFont.systemFont(ofSize: 18, weight: .bold)
576
-    let cardTime = NSFont.systemFont(ofSize: 14, weight: .regular)
576
+    let cardIcon = NSFont.systemFont(ofSize: 8, weight: .bold)
577
+    let cardTitle = NSFont.systemFont(ofSize: 15, weight: .semibold)
578
+    let cardSubtitle = NSFont.systemFont(ofSize: 13, weight: .bold)
579
+    let cardTime = NSFont.systemFont(ofSize: 12, weight: .regular)
577 580
 }
578 581