|
|
@@ -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
|
|
|
}
|
|
|
}
|
|
|
|