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

feat: create BarChart component #2637

Closed
wants to merge 7 commits into from

Conversation

artursantiago
Copy link
Collaborator

@artursantiago artursantiago commented Jan 28, 2025

What's the purpose of this pull request?

This pull request adds the ProgressBar component. Initially, this component will be used in the Reviews & Ratings section of the product page to display the percentage of each star rating from the reviews.

How it works?

This PR introduces the ProgressBar molecule component. It accepts value, min, and max as props, with default values set to 0 for value, 0 for min, and 100 for max.

To ensure the interface remains stable, the component includes a safeguard mechanism: if there is any inconsistency in the props (e.g., min being greater than max), a safeMax value is calculated to prevent the interface from breaking.

How to test it?

Starters Deploy Preview

Preview

References

JIRA TASK: SFS-2066

Figma

image

@artursantiago artursantiago added the enhancement New feature or request label Jan 28, 2025
@artursantiago artursantiago self-assigned this Jan 28, 2025
Copy link

vercel bot commented Jan 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
faststore-site ✅ Ready (Inspect) Visit Preview Jan 28, 2025 0:59am

Copy link

codesandbox-ci bot commented Jan 28, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@artursantiago artursantiago marked this pull request as ready for review January 30, 2025 17:43
@artursantiago artursantiago requested a review from a team as a code owner January 30, 2025 17:43
@artursantiago artursantiago requested review from eduardoformiga and lucasfp13 and removed request for a team January 30, 2025 17:43
@matheusps
Copy link
Contributor

Can you add the preview on storybook?

@artursantiago
Copy link
Collaborator Author

Can you add the preview on storybook?

@matheusps

I just fixed the preview link. You can test it now

@Guilera Guilera force-pushed the feat/add-progress-bar-component branch from 248eeac to a9b3f0c Compare February 14, 2025 13:59
// --------------------------------------------------------

--fs-progress-bar-height: 4px;
--fs-progress-bar-radius: 4px;
Copy link
Contributor

Choose a reason for hiding this comment

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

@renatamottam we don't have this for border radius, should we add a new token with this value (Are we using it in the future)? I'm considering to use --fs-border-radius-pill instead?

Copy link
Collaborator Author

@artursantiago artursantiago Feb 14, 2025

Choose a reason for hiding this comment

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

I also think its a good idea, the difference is basically none.

The first 3 border-radius has --fs-progress-bar-radius: 4px; and the last 3 has --fs-progress-bar-radius: var(--fs-border-radius-pill); // (100px)

image

@hellofanny
Copy link
Contributor

hellofanny commented Feb 14, 2025

@artursantiago I discussed this component with @renatamottam, and I believe this component should not be a ProgressBar. It is not meant to indicate progress feedback but rather to display a rating breakdown/distribution. I suggest approaching it like a BarChart since it visually represents data. Semantically, this would make more sense, and we might need to tweak the implementation a little bit if you agree. What do you think?

@hellofanny hellofanny changed the title feat: create ProgressBar component feat: create BarChart component Feb 17, 2025
Copy link
Contributor

@lariciamota lariciamota left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉
Could you just update the starter with those new changes so we can test?

import type { HTMLAttributes } from 'react'

export interface BarChartProps extends HTMLAttributes<HTMLDivElement> {
/* Current value of the progress */
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/* Current value of the progress */
/* Current value of the bar */

@artursantiago
Copy link
Collaborator Author

artursantiago commented Feb 18, 2025

We decided to keep this specific component inside RatingSummary. The RatingDistribution will include this component, displaying each rating score along with its percentage of the total.

The role of this element (progress bar, presentation, etc.) wasn’t very clear. We checked other applications like Amazon, Mercado Livre, and Samsung, but couldn’t find a consistent pattern. Since this component isn’t being used elsewhere, we’ve opted to keep it specific for now. If needed in the future, we can revisit the decision.

Closing this PR in favor of the new one:

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

Successfully merging this pull request may close these issues.

4 participants