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