-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add FXIOS-12363 β [Menu Redesign] Update horizontal squares options to the latest design #27115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add FXIOS-12363 β [Menu Redesign] Update horizontal squares options to the latest design #27115
Conversation
β¦s to the latest design
Client.app: Coverage: 35.41
Generated by π« Danger Swift against 9c5dcd5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments and suggestions in first pass
BrowserKit/Sources/MenuKit/MenuRedesign/MenuCollectionView.swift
Outdated
Show resolved
Hide resolved
if tabInfo.isHomepage { | ||
menuSections.append(getNewTabSection(with: uuid, tabInfo: tabInfo)) | ||
menuSections.append(getHorizontalTabsSection(with: uuid, tabInfo: tabInfo)) | ||
} else { | ||
menuSections.append(getSiteSection(with: uuid, tabInfo: tabInfo, isExpanded: isExpanded)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could merge else with inner if like: else if tabInfo.isHomepage {
for readability
cell.configureCellWith(model: section.options[indexPath.row]) | ||
if let theme { cell.applyTheme(theme: theme) } | ||
return cell | ||
} | ||
|
||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { | ||
collectionView.deselectItem(at: indexPath, animated: false) | ||
guard let section = menuData.first(where: { $0.isTopTabsSection }), | ||
guard let section = menuData.first(where: { $0.isHorizontalTabsSection }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check is done multiple times can be a computed var to avoid repeating the same code like
var horizontalTabsSection: MenuSection? {
return menuData.first(where: { $0.isHorizontalTabsSection })
}
@@ -77,11 +84,29 @@ final class MenuRedesignTableView: UIView, | |||
return section == 0 ? UX.topPadding : UX.distanceBetweenSections | |||
} | |||
|
|||
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | |||
if menuData[indexPath.section].isHorizontalTabsSection { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid calculating the height manually, I understand it is a cell containing a collection view but let's explore other solutions.
As last resort if we don't find a solution I think this logic should be in MenuCollectionView
or MenuSquareCell
instead of here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit about a comment that can be fixed in next PR. Great work refactoring
@@ -159,11 +174,11 @@ final class MenuRedesignTableView: UIView, | |||
} | |||
|
|||
func reloadTableView(with data: [MenuSection]) { | |||
// We ignore first section because it is handled in MenuCollectionView | |||
if let firstSection = data.first, firstSection.isTopTabsSection { | |||
// We ignore first section because it is handled in MenuSquaresViewContentCell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think the comment should be updated. We don't ignore the section just handled independently
} | ||
|
||
func reloadData(with data: [MenuSection]) { | ||
menuData = data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this is simpler to read, understand and maintain. Great work
π Tickets
Jira ticket
Github issue
π‘ Description
Updated horizontal cells based on the latest design
π₯ Demos
Demo
π Checklist
@Mergifyio backport release/v120
)