Ver código fonte

Refine sidebar brand header to keep Classroom fully visible.

Use the Classroom logo in the left brand row and adjust width, spacing, and typography so the title displays cleanly without clipping.

Made-with: Cursor
huzaifahayat12 1 semana atrás
pai
commit
1cb3a47ef6
1 arquivos alterados com 15 adições e 6 exclusões
  1. 15 6
      classroom_app/ViewController.swift

+ 15 - 6
classroom_app/ViewController.swift

@@ -1936,10 +1936,13 @@ private extension ViewController {
1936 1936
         sidebar.layer?.shadowOpacity = 0.18
1937 1937
         sidebar.layer?.shadowOffset = CGSize(width: 2, height: 0)
1938 1938
         sidebar.layer?.shadowRadius = 10
1939
-        sidebar.widthAnchor.constraint(equalToConstant: 210).isActive = true
1939
+        sidebar.widthAnchor.constraint(equalToConstant: 224).isActive = true
1940 1940
 
1941 1941
         let appIconView = NSImageView()
1942
-        if let headerLogo = NSImage(named: "HeaderLogo") {
1942
+        if let classroomLogo = NSImage(named: "icon_google_classroom") {
1943
+            classroomLogo.isTemplate = false
1944
+            appIconView.image = classroomLogo
1945
+        } else if let headerLogo = NSImage(named: "HeaderLogo") {
1943 1946
             headerLogo.isTemplate = false
1944 1947
             appIconView.image = headerLogo
1945 1948
         } else if let appIconImage = NSApplication.shared.applicationIconImage {
@@ -1950,17 +1953,23 @@ private extension ViewController {
1950 1953
         appIconView.imageScaling = NSImageScaling.scaleProportionallyDown
1951 1954
         appIconView.imageAlignment = NSImageAlignment.alignCenter
1952 1955
         appIconView.contentTintColor = nil
1953
-        appIconView.widthAnchor.constraint(equalToConstant: 44).isActive = true
1954
-        appIconView.heightAnchor.constraint(equalToConstant: 44).isActive = true
1956
+        appIconView.widthAnchor.constraint(equalToConstant: 40).isActive = true
1957
+        appIconView.heightAnchor.constraint(equalToConstant: 40).isActive = true
1958
+
1959
+        let sidebarBrandLabel = textLabel("Classroom", font: NSFont.systemFont(ofSize: 24, weight: .bold), color: palette.textPrimary)
1960
+        sidebarBrandLabel.maximumNumberOfLines = 1
1961
+        sidebarBrandLabel.lineBreakMode = .byTruncatingTail
1962
+        sidebarBrandLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
1963
+        sidebarBrandLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
1955 1964
 
1956 1965
         let titleRow = NSStackView(views: [
1957 1966
             appIconView,
1958
-            textLabel("Classroom", font: typography.sidebarBrand, color: palette.textPrimary)
1967
+            sidebarBrandLabel
1959 1968
         ])
1960 1969
         titleRow.translatesAutoresizingMaskIntoConstraints = false
1961 1970
         titleRow.orientation = NSUserInterfaceLayoutOrientation.horizontal
1962 1971
         titleRow.alignment = NSLayoutConstraint.Attribute.centerY
1963
-        titleRow.spacing = 16
1972
+        titleRow.spacing = 12
1964 1973
 
1965 1974
         let menuStack = NSStackView()
1966 1975
         menuStack.translatesAutoresizingMaskIntoConstraints = false