|
|
@@ -85,13 +85,13 @@ private extension ViewController {
|
|
85
|
85
|
menuStack.spacing = 10
|
|
86
|
86
|
|
|
87
|
87
|
menuStack.addArrangedSubview(sidebarSectionTitle("Meetings"))
|
|
88
|
|
- menuStack.addArrangedSubview(sidebarItem("Join Meetings", icon: "", selected: true))
|
|
|
88
|
+ menuStack.addArrangedSubview(sidebarItem("Join Meetings", icon: "", selected: true, logoImageName: "JoinMeetingsLogo", logoIconWidth: 24, logoHeightMultiplier: 56.0 / 52.0))
|
|
89
|
89
|
menuStack.addArrangedSubview(sidebarSectionTitle("Backgrounds"))
|
|
90
|
|
- menuStack.addArrangedSubview(sidebarItem("Photo", icon: "", selected: false))
|
|
91
|
|
- menuStack.addArrangedSubview(sidebarItem("Video", icon: "", selected: false))
|
|
|
90
|
+ menuStack.addArrangedSubview(sidebarItem("Photo", icon: "", selected: false, logoImageName: "SidebarPhotoLogo", logoIconWidth: 24, logoHeightMultiplier: 82.0 / 62.0, logoTemplate: false))
|
|
|
91
|
+ menuStack.addArrangedSubview(sidebarItem("Video", icon: "", selected: false, logoImageName: "SidebarVideoLogo", logoIconWidth: 28, logoHeightMultiplier: 52.0 / 60.0))
|
|
92
|
92
|
menuStack.addArrangedSubview(sidebarSectionTitle("Additional"))
|
|
93
|
|
- menuStack.addArrangedSubview(sidebarItem("Tutorials", icon: "", selected: false))
|
|
94
|
|
- menuStack.addArrangedSubview(sidebarItem("Settings", icon: "", selected: false))
|
|
|
93
|
+ menuStack.addArrangedSubview(sidebarItem("Tutorials", icon: "", selected: false, logoImageName: "SidebarTutorialsLogo", logoIconWidth: 24, logoHeightMultiplier: 50.0 / 60.0, logoTemplate: false))
|
|
|
94
|
+ menuStack.addArrangedSubview(sidebarItem("Settings", icon: "", selected: false, logoImageName: "SidebarSettingsLogo", logoIconWidth: 28, logoHeightMultiplier: 68.0 / 62.0))
|
|
95
|
95
|
|
|
96
|
96
|
sidebar.addSubview(titleRow)
|
|
97
|
97
|
sidebar.addSubview(menuStack)
|
|
|
@@ -365,7 +365,7 @@ private extension ViewController {
|
|
365
|
365
|
textLabel(text, font: typography.sidebarSection, color: palette.textMuted)
|
|
366
|
366
|
}
|
|
367
|
367
|
|
|
368
|
|
- func sidebarItem(_ text: String, icon: String, selected: Bool) -> NSView {
|
|
|
368
|
+ func sidebarItem(_ text: String, icon: String, selected: Bool, logoImageName: String? = nil, logoIconWidth: CGFloat = 18, logoHeightMultiplier: CGFloat = 1, logoTemplate: Bool = true) -> NSView {
|
|
369
|
369
|
let item = roundedContainer(cornerRadius: 9, color: selected ? palette.sidebarItemSelectedBackground : .clear)
|
|
370
|
370
|
item.translatesAutoresizingMaskIntoConstraints = false
|
|
371
|
371
|
item.heightAnchor.constraint(equalToConstant: 36).isActive = true
|
|
|
@@ -373,18 +373,41 @@ private extension ViewController {
|
|
373
|
373
|
styleSurface(item, borderColor: palette.sidebarItemSelectedBorder, borderWidth: 1, shadow: false)
|
|
374
|
374
|
}
|
|
375
|
375
|
|
|
376
|
|
- let iconLabelView = textLabel(icon, font: typography.sidebarIcon, color: selected ? palette.textPrimary : palette.textSecondary)
|
|
377
|
|
- let titleLabel = textLabel(text, font: typography.sidebarItem, color: selected ? palette.textPrimary : palette.textSecondary)
|
|
|
376
|
+ let tint = selected ? palette.textPrimary : palette.textSecondary
|
|
|
377
|
+ let leadingView: NSView
|
|
|
378
|
+ if let name = logoImageName, let logo = NSImage(named: name) {
|
|
|
379
|
+ let imageView = NSImageView(image: logo)
|
|
|
380
|
+ imageView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
381
|
+ imageView.imageScaling = .scaleProportionallyDown
|
|
|
382
|
+ imageView.imageAlignment = .alignCenter
|
|
|
383
|
+ imageView.isEditable = false
|
|
|
384
|
+ if logoTemplate {
|
|
|
385
|
+ imageView.contentTintColor = tint
|
|
|
386
|
+ }
|
|
|
387
|
+ leadingView = imageView
|
|
|
388
|
+ } else {
|
|
|
389
|
+ leadingView = textLabel(icon, font: typography.sidebarIcon, color: tint)
|
|
|
390
|
+ }
|
|
|
391
|
+
|
|
|
392
|
+ let titleLabel = textLabel(text, font: typography.sidebarItem, color: tint)
|
|
378
|
393
|
|
|
379
|
|
- item.addSubview(iconLabelView)
|
|
|
394
|
+ item.addSubview(leadingView)
|
|
380
|
395
|
item.addSubview(titleLabel)
|
|
381
|
396
|
|
|
382
|
|
- NSLayoutConstraint.activate([
|
|
383
|
|
- iconLabelView.leadingAnchor.constraint(equalTo: item.leadingAnchor, constant: 12),
|
|
384
|
|
- iconLabelView.centerYAnchor.constraint(equalTo: item.centerYAnchor),
|
|
385
|
|
- titleLabel.leadingAnchor.constraint(equalTo: iconLabelView.trailingAnchor, constant: 8),
|
|
|
397
|
+ var constraints: [NSLayoutConstraint] = [
|
|
|
398
|
+ leadingView.leadingAnchor.constraint(equalTo: item.leadingAnchor, constant: 12),
|
|
|
399
|
+ leadingView.centerYAnchor.constraint(equalTo: item.centerYAnchor),
|
|
|
400
|
+ titleLabel.leadingAnchor.constraint(equalTo: leadingView.trailingAnchor, constant: 8),
|
|
386
|
401
|
titleLabel.centerYAnchor.constraint(equalTo: item.centerYAnchor)
|
|
387
|
|
- ])
|
|
|
402
|
+ ]
|
|
|
403
|
+ if logoImageName != nil {
|
|
|
404
|
+ let h = logoIconWidth * logoHeightMultiplier
|
|
|
405
|
+ constraints.append(contentsOf: [
|
|
|
406
|
+ leadingView.widthAnchor.constraint(equalToConstant: logoIconWidth),
|
|
|
407
|
+ leadingView.heightAnchor.constraint(equalToConstant: h)
|
|
|
408
|
+ ])
|
|
|
409
|
+ }
|
|
|
410
|
+ NSLayoutConstraint.activate(constraints)
|
|
388
|
411
|
|
|
389
|
412
|
return item
|
|
390
|
413
|
}
|