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

Refresh Classroom branding and hover feedback on the main open page.

Use the provided Google Classroom logo for the Open Classroom card and add subtle hover states to remaining interactive controls for a more cohesive Classroom-like feel.

Made-with: Cursor
huzaifahayat12 1 неделя назад
Родитель
Сommit
008a66aa28

+ 21 - 0
classroom_app/Assets.xcassets/icon_google_classroom.imageset/Contents.json

@@ -0,0 +1,21 @@
1
+{
2
+  "images": [
3
+    {
4
+      "filename": "icon_google_classroom.png",
5
+      "idiom": "universal",
6
+      "scale": "1x"
7
+    },
8
+    {
9
+      "idiom": "universal",
10
+      "scale": "2x"
11
+    },
12
+    {
13
+      "idiom": "universal",
14
+      "scale": "3x"
15
+    }
16
+  ],
17
+  "info": {
18
+    "author": "xcode",
19
+    "version": 1
20
+  }
21
+}

BIN
classroom_app/Assets.xcassets/icon_google_classroom.imageset/icon_google_classroom.png


+ 27 - 6
classroom_app/ViewController.swift

@@ -2540,12 +2540,19 @@ private extension ViewController {
2540
         iconWrap.widthAnchor.constraint(equalToConstant: 58).isActive = true
2540
         iconWrap.widthAnchor.constraint(equalToConstant: 58).isActive = true
2541
         iconWrap.heightAnchor.constraint(equalToConstant: 58).isActive = true
2541
         iconWrap.heightAnchor.constraint(equalToConstant: 58).isActive = true
2542
         iconWrap.layer?.borderWidth = 0
2542
         iconWrap.layer?.borderWidth = 0
2543
-        let classSymbol = NSImage(systemSymbolName: "graduationcap.circle.fill", accessibilityDescription: "Google Classroom") ?? NSImage()
2544
-        let classLogo = NSImageView(image: classSymbol)
2543
+        let usesClassroomAsset = NSImage(named: "icon_google_classroom") != nil
2544
+        let classLogoImage =
2545
+            NSImage(named: "icon_google_classroom")
2546
+            ?? NSImage(systemSymbolName: "graduationcap.circle.fill", accessibilityDescription: "Google Classroom")
2547
+            ?? NSImage()
2548
+        classLogoImage.isTemplate = false
2549
+        let classLogo = NSImageView(image: classLogoImage)
2545
         classLogo.translatesAutoresizingMaskIntoConstraints = false
2550
         classLogo.translatesAutoresizingMaskIntoConstraints = false
2546
         classLogo.imageScaling = .scaleProportionallyDown
2551
         classLogo.imageScaling = .scaleProportionallyDown
2547
         classLogo.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 28, weight: .medium)
2552
         classLogo.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 28, weight: .medium)
2548
-        classLogo.contentTintColor = palette.primaryBlue
2553
+        if !usesClassroomAsset {
2554
+            classLogo.contentTintColor = palette.primaryBlue
2555
+        }
2549
         iconWrap.addSubview(classLogo)
2556
         iconWrap.addSubview(classLogo)
2550
 
2557
 
2551
         let instantTitle = textLabel("Open Classroom", font: NSFont.systemFont(ofSize: 40 / 2, weight: .semibold), color: palette.textPrimary)
2558
         let instantTitle = textLabel("Open Classroom", font: NSFont.systemFont(ofSize: 40 / 2, weight: .semibold), color: palette.textPrimary)
@@ -2605,15 +2612,19 @@ private extension ViewController {
2605
         ])
2612
         ])
2606
 
2613
 
2607
         let baseColor = palette.sectionCard
2614
         let baseColor = palette.sectionCard
2608
-        let hoverBlend = darkModeEnabled ? NSColor.white : NSColor.black
2609
-        let hoverColor = baseColor.blended(withFraction: 0.10, of: hoverBlend) ?? baseColor
2615
+        let baseBorderColor = palette.inputBorder
2616
+        let classroomHoverTint = NSColor(calibratedRed: 0.46, green: 0.80, blue: 0.42, alpha: 1.0)
2617
+        let hoverColor = baseColor.blended(withFraction: darkModeEnabled ? 0.24 : 0.16, of: classroomHoverTint) ?? baseColor
2618
+        let hoverBorderColor = baseBorderColor.blended(withFraction: darkModeEnabled ? 0.45 : 0.32, of: classroomHoverTint) ?? baseBorderColor
2610
         instant.onHoverChanged = { [weak self] hovering in
2619
         instant.onHoverChanged = { [weak self] hovering in
2611
             guard let self else { return }
2620
             guard let self else { return }
2612
             instant.layer?.backgroundColor = (hovering ? hoverColor : baseColor).cgColor
2621
             instant.layer?.backgroundColor = (hovering ? hoverColor : baseColor).cgColor
2622
+            instant.layer?.borderColor = (hovering ? hoverBorderColor : baseBorderColor).cgColor
2613
         }
2623
         }
2614
         codeCard.onHoverChanged = { [weak self] hovering in
2624
         codeCard.onHoverChanged = { [weak self] hovering in
2615
             guard let self else { return }
2625
             guard let self else { return }
2616
             codeCard.layer?.backgroundColor = (hovering ? hoverColor : baseColor).cgColor
2626
             codeCard.layer?.backgroundColor = (hovering ? hoverColor : baseColor).cgColor
2627
+            codeCard.layer?.borderColor = (hovering ? hoverBorderColor : baseBorderColor).cgColor
2617
         }
2628
         }
2618
         instant.onHoverChanged?(false)
2629
         instant.onHoverChanged?(false)
2619
         codeCard.onHoverChanged?(false)
2630
         codeCard.onHoverChanged?(false)
@@ -4068,7 +4079,7 @@ private extension ViewController {
4068
     }
4079
     }
4069
 
4080
 
4070
     private func makeScheduleScrollButton(systemSymbol: String, action: Selector) -> NSButton {
4081
     private func makeScheduleScrollButton(systemSymbol: String, action: Selector) -> NSButton {
4071
-        let button = NSButton(title: "", target: self, action: action)
4082
+        let button = HoverButton(title: "", target: self, action: action)
4072
         button.translatesAutoresizingMaskIntoConstraints = false
4083
         button.translatesAutoresizingMaskIntoConstraints = false
4073
         button.isBordered = false
4084
         button.isBordered = false
4074
         button.bezelStyle = .regularSquare
4085
         button.bezelStyle = .regularSquare
@@ -4085,6 +4096,16 @@ private extension ViewController {
4085
         button.focusRingType = .none
4096
         button.focusRingType = .none
4086
         button.heightAnchor.constraint(equalToConstant: 32).isActive = true
4097
         button.heightAnchor.constraint(equalToConstant: 32).isActive = true
4087
         button.widthAnchor.constraint(equalToConstant: 32).isActive = true
4098
         button.widthAnchor.constraint(equalToConstant: 32).isActive = true
4099
+        let baseColor = palette.inputBackground
4100
+        let baseBorder = palette.inputBorder
4101
+        let hoverBlend = darkModeEnabled ? NSColor.white : NSColor.black
4102
+        let hoverColor = baseColor.blended(withFraction: 0.10, of: hoverBlend) ?? baseColor
4103
+        let hoverBorder = baseBorder.blended(withFraction: 0.16, of: hoverBlend) ?? baseBorder
4104
+        button.onHoverChanged = { [weak button] hovering in
4105
+            button?.layer?.backgroundColor = (hovering ? hoverColor : baseColor).cgColor
4106
+            button?.layer?.borderColor = (hovering ? hoverBorder : baseBorder).cgColor
4107
+        }
4108
+        button.onHoverChanged?(false)
4088
         return button
4109
         return button
4089
     }
4110
     }
4090
 }
4111
 }