Skip to content

Commit b1337f4

Browse files
authoredMar 12, 2025
Add FXIOS-11598 [Tab tray UI experiment] Shadow on Experiment tab cell (#25273)
* Add shadow on Experiment tab cell * Adjust border width * Remove dispatch queue, turns out it wasn't needed 🤦
1 parent a41569a commit b1337f4

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed
 

‎firefox-ios/Client/Frontend/Browser/Tabs/Views/ExperimentTabCell.swift

+18-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import SiteImageView
1212
class ExperimentTabCell: UICollectionViewCell, ThemeApplicable, ReusableCell, FeatureFlaggable {
1313
struct UX {
1414
static let selectedBorderWidth: CGFloat = 3.0
15-
static let unselectedBorderWidth: CGFloat = 0.8
15+
static let unselectedBorderWidth: CGFloat = 1
1616
static let cornerRadius: CGFloat = 16
1717
static let subviewDefaultPadding: CGFloat = 6.0
1818
static let faviconSize = CGSize(width: 16, height: 16)
@@ -26,6 +26,9 @@ class ExperimentTabCell: UICollectionViewCell, ThemeApplicable, ReusableCell, Fe
2626
static let closeButtonTop: CGFloat = 6
2727
static let closeButtonTrailing: CGFloat = 8
2828
static let tabViewFooterSpacing: CGFloat = 4
29+
static let shadowRadius: CGFloat = 4
30+
static let shadowOffset = CGSize(width: 0, height: 2)
31+
static let shadowOpacity: Float = 1
2932
}
3033
// MARK: - Properties
3134

@@ -88,6 +91,12 @@ class ExperimentTabCell: UICollectionViewCell, ThemeApplicable, ReusableCell, Fe
8891
super.layoutSubviews()
8992
favicon.layer.cornerRadius = UX.faviconSize.height / 2
9093
smallFaviconView.layer.cornerRadius = UX.fallbackFaviconSize.height / 2
94+
95+
backgroundHolder.layoutIfNeeded()
96+
contentView.layer.shadowPath = UIBezierPath(
97+
roundedRect: self.backgroundHolder.bounds,
98+
cornerRadius: self.backgroundHolder.layer.cornerRadius
99+
).cgPath
91100
}
92101

93102
// MARK: - Initializer
@@ -171,6 +180,14 @@ class ExperimentTabCell: UICollectionViewCell, ThemeApplicable, ReusableCell, Fe
171180
screenshotView.backgroundColor = theme.colors.layer1
172181
favicon.tintColor = theme.colors.textPrimary
173182
smallFaviconView.tintColor = theme.colors.textPrimary
183+
setupShadow(theme: theme)
184+
}
185+
186+
func setupShadow(theme: Theme) {
187+
contentView.layer.shadowRadius = UX.shadowRadius
188+
contentView.layer.shadowOffset = UX.shadowOffset
189+
contentView.layer.shadowColor = theme.colors.shadowDefault.cgColor
190+
contentView.layer.shadowOpacity = UX.shadowOpacity
174191
}
175192

176193
// MARK: - Configuration
@@ -232,8 +249,6 @@ class ExperimentTabCell: UICollectionViewCell, ThemeApplicable, ReusableCell, Fe
232249
// Reset any close animations.
233250
super.prepareForReuse()
234251
screenshotView.image = nil
235-
backgroundHolder.transform = .identity
236-
backgroundHolder.alpha = 1
237252
smallFaviconView.isHidden = true
238253
layer.shadowOffset = .zero
239254
layer.shadowPath = nil

0 commit comments

Comments
 (0)
Failed to load comments.