Skip to content
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

[MBL-1500] Update and use banners for ppo #2094

Merged
merged 4 commits into from
Jul 11, 2024
Merged

[MBL-1500] Update and use banners for ppo #2094

merged 4 commits into from
Jul 11, 2024

Conversation

ifosli
Copy link
Contributor

@ifosli ifosli commented Jul 10, 2024

📲 What

Update the swiftUI banners and use a sample one in the PPO view.

Note: I've added a test helper for snapshots of a swiftui view instead of our current view controllers. This doesn't match the format of our current tests (with a lot of different device sizes), but we could easily extend this to add a default iPad frame and a default landscape frame as well.

I do think this way of testing swiftui might make it harder to test different Environments (ex different font sizes or color schemes) but I also don't think it's worth investing a lot of time into that until we start actually working on dark mode. I'm open to suggestions, though!

Also an intentional difference from the way we often test: I'm hardcoding strings here instead of using known strings and testing different languages. The goal of these tests isn't to test our translations, so having a short string and a long string for each layout should be sufficient and makes sure we don't have extraneous snapshots. If I've missed anything/there are other reasons to use translatable strings and test all/multiple languages, let me know!

👀 See

Jira

Also see snapshots!

♿️ Accessibility

  • Tap targets use minimum of 44x44 pts dimensions
  • Works with VoiceOver
  • Supports Dynamic Type

✅ Acceptance criteria

  • Banner is readable/useable and matches designs/our UIKit banners
  • Voiceover switches focus to the banner when it appears

@ifosli ifosli self-assigned this Jul 10, 2024
@ifosli ifosli marked this pull request as ready for review July 10, 2024 12:10
@ifosli ifosli requested a review from scottkicks July 10, 2024 12:10
.foregroundColor(vm.messageTextColor)
.padding(EdgeInsets(top: 16, leading: 9, bottom: 16, trailing: 9))
.background {
RoundedRectangle(cornerRadius: 6)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This corner radius (and possibly the padding) matches the figma for PPO but is different from the UIKit banners. I'm going to confirm with Alison if we want to match the figma or if we want to be consistent with the app before I submit the pr.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about having some kind of MessageBannerViewLayout enum to avoid hardcoding the padding, cornerRadius, minHeight, and spacing values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! I wanted to do a shared enum between the swiftUI and UIKit versions, but the UIKit version is primarily a storyboard, so I gave up on that pretty quickly... I've also changed some of the values (and re-recorded screenshots) after talking to Alison and determining that PPO styling should match current standards, not our Figma mocks.

Copy link
Contributor

@scottkicks scottkicks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Just a couple of suggestions. I like your point about keeping snapshots simple and testing only what's important in the given context!

.foregroundColor(vm.messageTextColor)
.padding(EdgeInsets(top: 16, leading: 9, bottom: 16, trailing: 9))
.background {
RoundedRectangle(cornerRadius: 6)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about having some kind of MessageBannerViewLayout enum to avoid hardcoding the padding, cornerRadius, minHeight, and spacing values?

@@ -0,0 +1,52 @@
@testable import Kickstarter_Framework
// @testable import KsApi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like we can remove this import for now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the image icon supposed to show in these snapshots? Either the checkmark or "i" info icon?

Copy link
Contributor Author

@ifosli ifosli Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we're not using an info icon - that's why the info banners are centered instead of aligned to the left. I think it's a bit of a weird choice, but it matches what our other banners do so I'm pretty sure it's intentional. I removed the empty image, though, so it should look better now!

@ifosli ifosli merged commit 9c990be into main Jul 11, 2024
5 checks passed
@ifosli ifosli deleted the bannersForPPO branch July 11, 2024 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants