|
|
@@ -154,8 +154,8 @@ private extension ViewController {
|
|
|
stack.distribution = .fillEqually
|
|
|
stack.spacing = 4
|
|
|
|
|
|
- stack.addArrangedSubview(topTab("Meet", icon: "", selected: true))
|
|
|
- stack.addArrangedSubview(topTab("Zoom", icon: "", selected: false))
|
|
|
+ stack.addArrangedSubview(topTab("Meet", icon: "", selected: true, logoImageName: "MeetLogo"))
|
|
|
+ stack.addArrangedSubview(topTab("Zoom", icon: "", selected: false, logoImageName: "ZoomLogo", logoPointSize: 30))
|
|
|
stack.addArrangedSubview(topTab("Teams", icon: "", selected: false))
|
|
|
stack.addArrangedSubview(topTab("Zoho", icon: "", selected: false))
|
|
|
|
|
|
@@ -389,22 +389,41 @@ private extension ViewController {
|
|
|
return item
|
|
|
}
|
|
|
|
|
|
- func topTab(_ title: String, icon: String, selected: Bool) -> NSView {
|
|
|
+ func topTab(_ title: String, icon: String, selected: Bool, logoImageName: String? = nil, logoPointSize: CGFloat = 26) -> NSView {
|
|
|
let tab = roundedContainer(cornerRadius: 19, color: selected ? palette.primaryBlue : .clear)
|
|
|
tab.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
|
|
- let iconLabelView = textLabel(icon, font: typography.tabIcon, color: palette.textPrimary)
|
|
|
+ let leadingView: NSView
|
|
|
+ if let name = logoImageName, let logo = NSImage(named: name) {
|
|
|
+ let imageView = NSImageView(image: logo)
|
|
|
+ imageView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ imageView.imageScaling = .scaleProportionallyDown
|
|
|
+ imageView.imageAlignment = .alignCenter
|
|
|
+ imageView.isEditable = false
|
|
|
+ imageView.contentTintColor = palette.textPrimary
|
|
|
+ leadingView = imageView
|
|
|
+ } else {
|
|
|
+ leadingView = textLabel(icon, font: typography.tabIcon, color: palette.textPrimary)
|
|
|
+ }
|
|
|
+
|
|
|
let titleLabel = textLabel(title, font: typography.tabTitle, color: palette.textPrimary)
|
|
|
|
|
|
- tab.addSubview(iconLabelView)
|
|
|
+ tab.addSubview(leadingView)
|
|
|
tab.addSubview(titleLabel)
|
|
|
|
|
|
- NSLayoutConstraint.activate([
|
|
|
- iconLabelView.leadingAnchor.constraint(equalTo: tab.leadingAnchor, constant: 16),
|
|
|
- iconLabelView.centerYAnchor.constraint(equalTo: tab.centerYAnchor),
|
|
|
- titleLabel.leadingAnchor.constraint(equalTo: iconLabelView.trailingAnchor, constant: 6),
|
|
|
+ var constraints: [NSLayoutConstraint] = [
|
|
|
+ leadingView.leadingAnchor.constraint(equalTo: tab.leadingAnchor, constant: 16),
|
|
|
+ leadingView.centerYAnchor.constraint(equalTo: tab.centerYAnchor),
|
|
|
+ titleLabel.leadingAnchor.constraint(equalTo: leadingView.trailingAnchor, constant: 6),
|
|
|
titleLabel.centerYAnchor.constraint(equalTo: tab.centerYAnchor)
|
|
|
- ])
|
|
|
+ ]
|
|
|
+ if logoImageName != nil {
|
|
|
+ constraints.append(contentsOf: [
|
|
|
+ leadingView.widthAnchor.constraint(equalToConstant: logoPointSize),
|
|
|
+ leadingView.heightAnchor.constraint(equalToConstant: logoPointSize)
|
|
|
+ ])
|
|
|
+ }
|
|
|
+ NSLayoutConstraint.activate(constraints)
|
|
|
|
|
|
return tab
|
|
|
}
|