Activity Log: filter bar design#15468
Conversation
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
| let filterIcon = UIImageView(image: UIImage.gridicon(.filter)) | ||
| filterIcon.tintColor = .listIcon | ||
| filterIcon.heightAnchor.constraint(equalToConstant: Constants.filterHeightAnchor).isActive = true | ||
| filterStackView.alignment = .center | ||
| filterStackView.spacing = Constants.filterStackViewSpacing | ||
| filterStackView.addArrangedSubview(filterIcon) | ||
| let scrollView = UIScrollView() | ||
| scrollView.canCancelContentTouches = true | ||
| filterStackView.addArrangedSubview(dateFilterChip) | ||
| filterStackView.addArrangedSubview(activityTypeFilterChip) | ||
| scrollView.addSubview(filterStackView) | ||
| containerStackView.addArrangedSubview(scrollView) | ||
| filterStackView.translatesAutoresizingMaskIntoConstraints = false | ||
| NSLayoutConstraint.activate([ | ||
| filterStackView.leftAnchor.constraint(equalTo: scrollView.leftAnchor), | ||
| filterStackView.topAnchor.constraint(equalTo: scrollView.topAnchor), | ||
| filterStackView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor), | ||
| scrollView.heightAnchor.constraint(equalTo: filterStackView.heightAnchor) | ||
| filterStackView.leftAnchor.constraint(equalTo: scrollView.leftAnchor, constant: Constants.filterBarHorizontalPadding), | ||
| filterStackView.rightAnchor.constraint(equalTo: scrollView.rightAnchor, constant: Constants.filterBarHorizontalPadding), | ||
| filterStackView.topAnchor.constraint(equalTo: scrollView.topAnchor, constant: Constants.filterBarVerticalPadding), | ||
| filterStackView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor, constant: Constants.filterBarVerticalPadding), | ||
| scrollView.heightAnchor.constraint(equalTo: filterStackView.heightAnchor, constant: 2 * Constants.filterBarVerticalPadding) | ||
| ]) | ||
|
|
||
| setupDateFilter() | ||
|
|
||
| setupActivityTypeFilter() | ||
|
|
||
| let separator = UIView() | ||
| separator.translatesAutoresizingMaskIntoConstraints = false | ||
| scrollView.addSubview(separator) | ||
| NSLayoutConstraint.activate([ | ||
| separator.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor, constant: 16), | ||
| separator.leftAnchor.constraint(equalTo: scrollView.leftAnchor), | ||
| separator.widthAnchor.constraint(equalTo: scrollView.widthAnchor), | ||
| separator.heightAnchor.constraint(equalToConstant: 1) | ||
| ]) | ||
| WPStyleGuide.applyBorderStyle(separator) |
There was a problem hiding this comment.
This method is pretty messy. What do you think about doing something like:
filterStackView.alignment = .center
filterStackView.spacing = Constants.filterStackViewSpacing
filterStackView.translatesAutoresizingMaskIntoConstraints = false
let filterIcon = UIImageView(image: UIImage.gridicon(.filter))
filterIcon.tintColor = .listIcon
filterIcon.heightAnchor.constraint(equalToConstant: Constants.filterHeightAnchor).isActive = true
filterStackView.addArrangedSubview(filterIcon)
filterStackView.addArrangedSubview(dateFilterChip)
filterStackView.addArrangedSubview(activityTypeFilterChip)
let scrollView = UIScrollView()
scrollView.canCancelContentTouches = true
scrollView.addSubview(filterStackView)
containerStackView.addArrangedSubview(scrollView)
NSLayoutConstraint.activate([
filterStackView.leftAnchor.constraint(equalTo: scrollView.leftAnchor, constant: Constants.filterBarHorizontalPadding),
filterStackView.rightAnchor.constraint(equalTo: scrollView.rightAnchor, constant: Constants.filterBarHorizontalPadding),
filterStackView.topAnchor.constraint(equalTo: scrollView.topAnchor, constant: Constants.filterBarVerticalPadding),
filterStackView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor, constant: Constants.filterBarVerticalPadding),
scrollView.heightAnchor.constraint(equalTo: filterStackView.heightAnchor, constant: 2 * Constants.filterBarVerticalPadding)
])
setupDateFilter()
setupActivityTypeFilter()
let separator = UIView()
separator.translatesAutoresizingMaskIntoConstraints = false
scrollView.addSubview(separator)
NSLayoutConstraint.activate([
separator.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor, constant: 16),
separator.leftAnchor.constraint(equalTo: scrollView.leftAnchor),
separator.widthAnchor.constraint(equalTo: scrollView.widthAnchor),
separator.heightAnchor.constraint(equalToConstant: 1)
])
There was a problem hiding this comment.
Done in f94c667
I also extracted the filter to its own file.
|
Very slick, great job. A couple of really nice touches. The smart reselection of dates is great (adapting the start/end date whichever I'm closer to). Loading state works well. Generally feels very polished. Minor details to consider:
I haven't gotten the build working on my iPad yet but thought I'd share these. If I notice anything on iPad I'll add it later. |
|
👋 Howdy! Today's the day we're cutting the Because of that, this PR will be bumped to |
WordPress/Classes/ViewRelated/Activity/Filter/FilterBarView.swift
Outdated
Show resolved
Hide resolved
|
@emilylaguna @osullivanchris ready for another review! |
|
@emilylaguna fixed in cedc3b1 |
emilylaguna
left a comment
There was a problem hiding this comment.
👏 Nice, working very well now.
All looks great now
Noting you have a kinda animation going I think when the chip changes. I wasn't expecting it, but I think I like it. Have not been able to view directly on iPad, but looks good based on screenshots. Big 👍 from me. |





Part of #15192
Adds filter bar design + few enhancements on the calendar.
To test
Please, test by:
PR submission checklist:
RELEASE-NOTES.txtif necessary.