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

[PM-14422] Vault Carousel #12791

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Conversation

nick-livefront
Copy link
Collaborator

@nick-livefront nick-livefront commented Jan 9, 2025

🎟️ Tracking

PM-14422

📔 Objective

Adds a Carousel components to Storybook under Vault/Carousel

There is a possibility that an implementation has differing heights across slides, which can result in the controls jumping around vertically. I added an input to provide a set height for the carousel so the controls can be pushed to the bottom.
A couple other ideas:

  • Define a couple set heights that implementations can choose from?
  • Edit: I ended up attempted this one: The carousel component could render each slide invisible to the user and find the max height and then use that as a set height for all slides.

📸 Screenshots

Carousel Carousel Screen Reader
Screen.Recording.2025-01-09.at.2.46.38.PM.mov
carousel-screen-reader.mov

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@nick-livefront nick-livefront requested review from a team as code owners January 9, 2025 20:58
@merissaacosta merissaacosta requested review from vleague2 and removed request for merissaacosta January 9, 2025 21:03
Copy link
Contributor

github-actions bot commented Jan 9, 2025

Logo
Checkmarx One – Scan Summary & Details96121822-7e6a-4ecf-9f14-5684b45e3245

Great job, no security vulnerabilities found in this Pull Request

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 81.42857% with 13 lines in your changes missing coverage. Please review.

Project coverage is 34.37%. Comparing base (99937e5) to head (37cdf3f).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../vault/src/components/carousel/carousel.stories.ts 0.00% 9 Missing ⚠️
...ault/src/components/carousel/carousel.component.ts 94.28% 2 Missing ⚠️
...arousel/carousel-slide/carousel-slide.component.ts 87.50% 0 Missing and 1 partial ⚠️
libs/vault/src/components/carousel/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12791      +/-   ##
==========================================
+ Coverage   34.34%   34.37%   +0.02%     
==========================================
  Files        2965     2972       +7     
  Lines       90533    90603      +70     
  Branches    16977    16980       +3     
==========================================
+ Hits        31094    31144      +50     
- Misses      56975    56994      +19     
- Partials     2464     2465       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sukhleenb
Copy link

sukhleenb commented Jan 9, 2025

This looks great! Something minor, the focus state in the recording differs slightly from what has been defined here. Could we match the Figma UI for consistency? Also is the click target at least 24px?

Copy link
Contributor

@vleague2 vleague2 left a comment

Choose a reason for hiding this comment

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

One thought on a quick look!

* Provide a height value of the tallest slide to prevent this.
* The value should be in `rem`.
*/
@Input() height?: `${number}rem` | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

💭 I wonder if you can do this internally in the component? If you have access to all the slides (I haven't fully reviewed to check), you could grab the rendered element height of the tallest one and then set the height to that? (You might have to have all of them rendered but hidden to do that)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

💯 That was one of my ideas in the description. I think I'll have to render them off screen to avoid causing flashes to the user but I'll give it a shot!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nick-livefront
Copy link
Collaborator Author

nick-livefront commented Jan 10, 2025

This looks great! Something minor, the focus state in the recording differs slightly from what has been defined here. Could we match the Figma UI for consistency?

@sukhleenb Thank you for linking those! I didn't see those designs in the ticket.

Also is the click target at least 24px?

Yes!

Screen.Recording.2025-01-10.at.1.43.38.PM.mov

* Provide a height value of the tallest slide to prevent this.
* The value should be in `rem`.
*/
@Input() height?: `${number}rem` | undefined;
Copy link
Member

Choose a reason for hiding this comment

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

❓ should we have a default height if none is provided?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I ended up calculating the height myself, see: #12791 (comment)

- This avoids consumers having to pass in a height.
- The height of the tallest slide is needed because it will stop the carousel from jumping around as the user scrolls.
@nick-livefront
Copy link
Collaborator Author

@vleague2 @gbubemismith you both pointed out the height Input. I added a decent amount of logic to render each slide, get the tallest height and set the height of the carousel that way. Let me know what you think!

550d86a

});

// Set the min height of the entire carousel based on the largest slide.
this.minHeight = `${(tallestSlideHeightPx + heightOfButtonsPx) / ROOT_PX_FONT_SIZE}rem`;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is fine to leave this in pixels since it is dynamically calculated. I have some concerns about storing the root px font size in this file since it will likely get out of sync if we change the base font size in the css again, so using pixels for this minHeight means we don't need to do that.


private _contentPortal: TemplatePortal | null = null;

get content(): TemplatePortal | null {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a blocker, but maybe add a comment here about what this is used for since it's not used directly in the template?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants