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

[BD-8468][BpkCarousel] new component for mobile #3059

Merged
merged 181 commits into from
Jun 7, 2024
Merged

Conversation

R1CC1M
Copy link
Contributor

@R1CC1M R1CC1M commented Nov 3, 2023

Added carousel component for mobile screens which displays images which can be swiped to move onto the next image.

Screenshot 2023-11-03 at 13 15 26

Remember to include the following changes:

  • README.md (If you have created a new component)
  • Component README.md
  • Tests
  • Storybook examples created/updated
  • For breaking changes or deprecating components/properties, migration guides added to the description of the PR. If the guide has large changes, consider creating a new Markdown page inside the component's docs folder and link it here

@R1CC1M R1CC1M added the minor Non breaking change label Nov 3, 2023
@olliecurtis olliecurtis self-requested a review November 3, 2023 09:47
Copy link

github-actions bot commented Nov 3, 2023

Warnings
⚠️

Package source files (e.g. packages/package-name/src/Component.tsx) were updated, but type files weren't. Have you checked that no types have changed?

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against 825802b

Copy link

github-actions bot commented Nov 3, 2023

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

packages/bpk-component-carousel/README.md Outdated Show resolved Hide resolved
packages/bpk-component-carousel/src/index.ts Outdated Show resolved Hide resolved
examples/bpk-component-carousel/example.js Show resolved Hide resolved
examples/bpk-component-carousel/stories.js Show resolved Hide resolved
examples/bpk-component-carousel/example.js Outdated Show resolved Hide resolved
packages/bpk-component-carousel/src/accessibility-test.tsx Outdated Show resolved Hide resolved
packages/bpk-component-carousel/src/types.ts Show resolved Hide resolved
packages/bpk-component-carousel/src/utils.tsx Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Nov 3, 2023

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link

github-actions bot commented Nov 3, 2023

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link

github-actions bot commented Nov 3, 2023

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link
Member

@olliecurtis olliecurtis left a comment

Choose a reason for hiding this comment

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

Couple of minor changes and otherwise this looks good to me

examples/bpk-component-carousel/stories.js Show resolved Hide resolved
packages/bpk-component-carousel/README.md Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Nov 3, 2023

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link

github-actions bot commented Nov 3, 2023

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link

github-actions bot commented Nov 3, 2023

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link

github-actions bot commented Jun 5, 2024

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link

github-actions bot commented Jun 5, 2024

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

@KathyWang0208
Copy link
Contributor

Can we check the TalkBack and VoiceOver on this component?

Doing a check it looks like initially to work but when you get to the last image it then goes through the indicator component individually and you have to cycle through the whole component which doesn't have any descriptions to them or are selectable like the page indicator component

BpkCarousel is only for mobile, we don't pass onClick prop to BpkPageIndicator, so I made some changes inBpkPageIndicator to fix a11y issue.

Copy link

github-actions bot commented Jun 6, 2024

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

@KathyWang0208 KathyWang0208 changed the title backpack carousel []BD-8468][BpkCarousel] new component Jun 6, 2024
@KathyWang0208 KathyWang0208 changed the title []BD-8468][BpkCarousel] new component []BD-8468][BpkCarousel] new component for mobile Jun 6, 2024
@KathyWang0208 KathyWang0208 changed the title []BD-8468][BpkCarousel] new component for mobile [BD-8468][BpkCarousel] new component for mobile Jun 6, 2024
Copy link

github-actions bot commented Jun 6, 2024

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link

github-actions bot commented Jun 6, 2024

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link

github-actions bot commented Jun 6, 2024

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

images: ReactNode[]
initialImageIndex?: number;
onImageChanged?: OnImageChangedHandler
bottom?: number;
Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of this property?

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the figma definition it doesn't seem to be included there.

If we need this then it would be good for us to add a comment above in the following format, so that our autogenerated docs can pick this up and make it clear to consumers what it does

  /**
   * Put your description here
   */
  bottom?: number;

@@ -36,19 +36,19 @@ export const VARIANT = {
};

export type Props = {
className: ?string,
Copy link
Member

Choose a reason for hiding this comment

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

This is going to cause a major release by removing this property for consumers so we need to be careful in its removal, as there is now going to be consumer impact

Copy link
Contributor

Choose a reason for hiding this comment

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

I was hesitant to get rid of it because a recent rule is not to recommend className.
Based on your comment, I am confident to revert the change, thank you.

Comment on lines 43 to 45
indicatorLabel: ?string,
prevNavLabel: ?string,
nextNavLabel: ?string,
Copy link
Member

Choose a reason for hiding this comment

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

What would be the reason for moving these to optional? Seems a significant change/risk to non carousel users

Copy link
Contributor

Choose a reason for hiding this comment

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

In carousel, we don't need to pass the onClick function to BpkPageIndicator, and these label are used to render the button(only onClick is available, the button is rendered), so here I changed them as optional.

But I also worried about what you said, so I reverted the changes, and set the default en label in carousel(they won't be used in BpkPageIndicator, so they don't introduce the localization issues I think).

variant: ?$Keys<typeof VARIANT>,
bottom: ?number,
Copy link
Member

Choose a reason for hiding this comment

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

Similar to previous

What is the purpose of this property?

If we need this then it would be good for us to add a comment above in the following format, so that our autogenerated docs can pick this up and make it clear to consumers what it does

  /**
   * Put your description here
   */
  bottom?: number;

<div className={className}>
}: Props) => {
const isOverImage = variant === VARIANT.overImage;
const isInteractive = !!onClick;
Copy link
Member

Choose a reason for hiding this comment

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

Could you clarify or add a comment as the purpose of this?

Copy link
Contributor

@KathyWang0208 KathyWang0208 Jun 7, 2024

Choose a reason for hiding this comment

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

For isOverImage, why I did this change before I was thinking this component should include the corresponding css when customer pass VARIANT.overImage and in order to be compatible with the custom bottom spacing, customer need pass one more prop bottom, it seems too many changes for this existing component, so I moved this css for overImage to BpkCarousel.

For isInteractive, I will add some comments.

@olliecurtis
Copy link
Member

Doing a quick test for interaction andTalkBack test on Android, it looks like when the component first loads image one is last and the last indicator dot is highlighted, so when you scroll though its like it starts on the last element and then when you get the last element the first dot is highlighted.

Wondering if this is related to this question about logic I had in the past is in the reverse order? https://github.com/Skyscanner/backpack/pull/3059/files#r1382019852

Copy link

github-actions bot commented Jun 7, 2024

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link

github-actions bot commented Jun 7, 2024

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

@KathyWang0208
Copy link
Contributor

KathyWang0208 commented Jun 7, 2024

Doing a quick test for interaction andTalkBack test on Android, it looks like when the component first loads image one is last and the last indicator dot is highlighted, so when you scroll though its like it starts on the last element and then when you get the last element the first dot is highlighted.

Wondering if this is related to this question about logic I had in the past is in the reverse order? https://github.com/Skyscanner/backpack/pull/3059/files#r1382019852

Yes, in order for the scroll snap to create an infinite loop, here render extra two images.

Copy link

github-actions bot commented Jun 7, 2024

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link

github-actions bot commented Jun 7, 2024

Visit https://backpack.github.io/storybook-prs/3059 to see this build running in a browser.

Copy link
Member

@olliecurtis olliecurtis left a comment

Choose a reason for hiding this comment

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

LGTM!

Thank you

@olliecurtis olliecurtis merged commit 2b59610 into main Jun 7, 2024
10 checks passed
@olliecurtis olliecurtis deleted the bpk-carousel branch June 7, 2024 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Non breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.