Quellcode durchsuchen

Apply purple branding to the sidebar logo and Premium nav item.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 vor 15 Stunden
Ursprung
Commit
3b98916bf1
2 geänderte Dateien mit 20 neuen und 8 gelöschten Zeilen
  1. 2 2
      smart_printer/SidebarView.swift
  2. 18 6
      smart_printer/UIComponents.swift

+ 2 - 2
smart_printer/SidebarView.swift

@@ -38,7 +38,7 @@ final class SidebarView: NSView {
38 38
             let config = NSImage.SymbolConfiguration(pointSize: 28, weight: .medium)
39 39
             logoIcon.image = image.withSymbolConfiguration(config)
40 40
         }
41
-        logoIcon.contentTintColor = AppTheme.blue
41
+        logoIcon.contentTintColor = AppTheme.purple
42 42
 
43 43
         let appNameLabel = NSTextField(labelWithString: "Smart Printer")
44 44
         appNameLabel.font = AppTheme.semiboldFont(size: 15)
@@ -54,7 +54,7 @@ final class SidebarView: NSView {
54 54
 
55 55
         let homeItem = SidebarNavItem(title: "Home", symbolName: "house.fill", isSelected: true)
56 56
         let scanItem = SidebarNavItem(title: "Scan", symbolName: "viewfinder")
57
-        let scanAndHomeItem = SidebarNavItem(title: "Premium", symbolName: "diamond.fill")
57
+        let scanAndHomeItem = SidebarNavItem(title: "Premium", symbolName: "diamond.fill", accent: .premium)
58 58
 
59 59
         navItems = [homeItem, scanItem, scanAndHomeItem]
60 60
         for (index, item) in navItems.enumerated() {

+ 18 - 6
smart_printer/UIComponents.swift

@@ -63,8 +63,14 @@ final class SidebarNavItem: NSControl {
63 63
         case active
64 64
     }
65 65
 
66
+    enum Accent {
67
+        case standard
68
+        case premium
69
+    }
70
+
66 71
     var onClick: (() -> Void)?
67 72
 
73
+    private let accent: Accent
68 74
     private let iconView = NSImageView()
69 75
     private let titleLabel = NSTextField(labelWithString: "")
70 76
     private let container = NSView()
@@ -73,7 +79,8 @@ final class SidebarNavItem: NSControl {
73 79
         didSet { applyStyle(isSelected ? .active : .normal) }
74 80
     }
75 81
 
76
-    init(title: String, symbolName: String, isSelected: Bool = false) {
82
+    init(title: String, symbolName: String, isSelected: Bool = false, accent: Accent = .standard) {
83
+        self.accent = accent
77 84
         super.init(frame: .zero)
78 85
         self.isSelected = isSelected
79 86
 
@@ -124,15 +131,20 @@ final class SidebarNavItem: NSControl {
124 131
         container.wantsLayer = true
125 132
         container.layer?.cornerRadius = AppTheme.cornerRadius
126 133
 
134
+        let activeBackground = accent == .premium ? AppTheme.premiumBackground : AppTheme.homeActiveBackground
135
+        let activeForeground = accent == .premium ? AppTheme.premiumForeground : AppTheme.homeActiveForeground
136
+
137
+        let normalForeground = accent == .premium ? AppTheme.premiumForeground : AppTheme.textPrimary
138
+
127 139
         switch style {
128 140
         case .normal:
129 141
             container.layer?.backgroundColor = NSColor.clear.cgColor
130
-            titleLabel.textColor = AppTheme.textPrimary
131
-            iconView.contentTintColor = AppTheme.textPrimary
142
+            titleLabel.textColor = normalForeground
143
+            iconView.contentTintColor = normalForeground
132 144
         case .active:
133
-            container.layer?.backgroundColor = AppTheme.homeActiveBackground.cgColor
134
-            titleLabel.textColor = AppTheme.homeActiveForeground
135
-            iconView.contentTintColor = AppTheme.homeActiveForeground
145
+            container.layer?.backgroundColor = activeBackground.cgColor
146
+            titleLabel.textColor = activeForeground
147
+            iconView.contentTintColor = activeForeground
136 148
         }
137 149
     }
138 150