Skip to content

Commit

Permalink
Fix #5864: Truncate library heading when one word is too long
Browse files Browse the repository at this point in the history
  • Loading branch information
dnarcese committed Feb 8, 2020
1 parent 77ea30f commit c759fc1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Client/Frontend/Home/FirefoxHomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ class LibraryShortcutView: UIView {
}
title.adjustsFontSizeToFitWidth = true
title.minimumScaleFactor = 0.7
title.numberOfLines = 2
title.lineBreakMode = .byTruncatingTail
title.font = DynamicFontHelper.defaultHelper.SmallSizeRegularWeightAS
title.textAlignment = .center
title.snp.makeConstraints { make in
Expand Down Expand Up @@ -1099,6 +1099,8 @@ class ASLibraryCell: UICollectionViewCell, Themeable {
let view = LibraryShortcutView()
view.button.setImage(item.image, for: .normal)
view.title.text = item.title
let words = view.title.text?.components(separatedBy: NSCharacterSet.whitespacesAndNewlines).count
view.title.numberOfLines = words == 1 ? 1 :2
view.button.backgroundColor = item.color
view.button.setTitleColor(UIColor.theme.homePanel.topSiteDomain, for: .normal)
view.accessibilityLabel = item.title
Expand Down

0 comments on commit c759fc1

Please sign in to comment.