ソースを参照

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

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 1 ヶ月 前
コミット
3b98916bf1
2 ファイル変更20 行追加8 行削除
  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 {
             let config = NSImage.SymbolConfiguration(pointSize: 28, weight: .medium)
             logoIcon.image = image.withSymbolConfiguration(config)
         }
-        logoIcon.contentTintColor = AppTheme.blue
+        logoIcon.contentTintColor = AppTheme.purple
 
         let appNameLabel = NSTextField(labelWithString: "Smart Printer")
         appNameLabel.font = AppTheme.semiboldFont(size: 15)
@@ -54,7 +54,7 @@ final class SidebarView: NSView {
 
         let homeItem = SidebarNavItem(title: "Home", symbolName: "house.fill", isSelected: true)
         let scanItem = SidebarNavItem(title: "Scan", symbolName: "viewfinder")
-        let scanAndHomeItem = SidebarNavItem(title: "Premium", symbolName: "diamond.fill")
+        let scanAndHomeItem = SidebarNavItem(title: "Premium", symbolName: "diamond.fill", accent: .premium)
 
         navItems = [homeItem, scanItem, scanAndHomeItem]
         for (index, item) in navItems.enumerated() {

+ 18 - 6
smart_printer/UIComponents.swift

@@ -63,8 +63,14 @@ final class SidebarNavItem: NSControl {
         case active
     }
 
+    enum Accent {
+        case standard
+        case premium
+    }
+
     var onClick: (() -> Void)?
 
+    private let accent: Accent
     private let iconView = NSImageView()
     private let titleLabel = NSTextField(labelWithString: "")
     private let container = NSView()
@@ -73,7 +79,8 @@ final class SidebarNavItem: NSControl {
         didSet { applyStyle(isSelected ? .active : .normal) }
     }
 
-    init(title: String, symbolName: String, isSelected: Bool = false) {
+    init(title: String, symbolName: String, isSelected: Bool = false, accent: Accent = .standard) {
+        self.accent = accent
         super.init(frame: .zero)
         self.isSelected = isSelected
 
@@ -124,15 +131,20 @@ final class SidebarNavItem: NSControl {
         container.wantsLayer = true
         container.layer?.cornerRadius = AppTheme.cornerRadius
 
+        let activeBackground = accent == .premium ? AppTheme.premiumBackground : AppTheme.homeActiveBackground
+        let activeForeground = accent == .premium ? AppTheme.premiumForeground : AppTheme.homeActiveForeground
+
+        let normalForeground = accent == .premium ? AppTheme.premiumForeground : AppTheme.textPrimary
+
         switch style {
         case .normal:
             container.layer?.backgroundColor = NSColor.clear.cgColor
-            titleLabel.textColor = AppTheme.textPrimary
-            iconView.contentTintColor = AppTheme.textPrimary
+            titleLabel.textColor = normalForeground
+            iconView.contentTintColor = normalForeground
         case .active:
-            container.layer?.backgroundColor = AppTheme.homeActiveBackground.cgColor
-            titleLabel.textColor = AppTheme.homeActiveForeground
-            iconView.contentTintColor = AppTheme.homeActiveForeground
+            container.layer?.backgroundColor = activeBackground.cgColor
+            titleLabel.textColor = activeForeground
+            iconView.contentTintColor = activeForeground
         }
     }