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/product comparison packages UI components #2594

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

Conversation

HiagoMoreiraCubos
Copy link
Collaborator

@HiagoMoreiraCubos HiagoMoreiraCubos commented Dec 13, 2024

This PR includes the construction of the Product Comparison components: ProductComparison, ProductComparisonTrigger, ProductComparisonToolbar, ProductComparisonSidebar.

In addition to the components, the PR also contains the ProductComparisonProvider, which manages all the internal state of the ProductComparison. This provider contains the display condition of the ProductComparisonToolbar, the open and close state of the SlideOver and the product data to be displayed in the ProductComparisonSidebar. To use the ProductComparison correctly, it is necessary to involve the use of the smaller components previously mentioned with the provider, thus avoiding using them in isolation. There is a validation implemented in the useProductComparison hook.

The useProductComparison hook is responsible for consuming the ProductComparisonProvider and returning all the properties, so that the components in the chain can make use of them. The validation was implemented within this hook.

Preview Link: https://starter-b4omfq9wh-vtex.vercel.app/

Printscreens

Screenshot 2024-12-20 at 16 54 21

Screenshot 2024-12-20 at 16 55 17 Screenshot 2024-12-20 at 16 55 28 Screenshot 2024-12-20 at 16 55 53

@HiagoMoreiraCubos HiagoMoreiraCubos requested a review from a team as a code owner December 13, 2024 12:41
@HiagoMoreiraCubos HiagoMoreiraCubos requested review from pedromtec and renatomaurovtex and removed request for a team December 13, 2024 12:41
Copy link

vercel bot commented Dec 13, 2024

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

Name Status Preview Updated (UTC)
faststore-site ✅ Ready (Inspect) Visit Preview Jan 6, 2025 6:45pm

Copy link

codesandbox-ci bot commented Dec 13, 2024

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.

Copy link
Contributor

@renatamottam renatamottam left a comment

Choose a reason for hiding this comment

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

Hi team! Thanks for this work ✨
I left a couple suggestions and comments below related to interactions on the PLP page. I'll review the Sidebar after.

Copy link
Contributor

Choose a reason for hiding this comment

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

cc: @hellofanny
I don't see this component as a library option. Maybe it could be moved to faststore/core, what do you think?

@renatamottam renatamottam added the contributing Pull request submitted by the community label Dec 17, 2024
Comment on lines +61 to +63
<Button variant="tertiary" onClick={() => clearProducts()}>
{clearSelectionButtonLabel}
</Button>
Copy link
Contributor

Choose a reason for hiding this comment

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

This button is not properly working. It should clear all the selections.

New comparison After "clear selection"
image

// Design Tokens for Product Comparison Toolbar
// --------------------------------------------------------

// Default properties
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a gap between the buttons here, use var(--fs-spacing-2)

bottom: 0;

padding: var(--fs-spacing-4) var(--fs-spacing-8);
border-top: var(--fs-border-width) solid var(--fs-border-color-light);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not on Figma, please use a box-shadow instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing a border-top here, could you please add to [data-fs-product-listing-results]?

Figma prototype
image

Copy link
Contributor

Choose a reason for hiding this comment

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

The SlideOverHeader shouldn't change position on horizontal scroll:
image

Comment on lines +172 to +181
div {
display: flex;
align-items: center;

p {
font-size: var(--fs-text-size-2);
font-weight: var(--fs-product-comparison-text-weight);
margin-right: var(--fs-spacing-3);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this after change it to SelectField

[data-fs-table-head] {
[data-fs-table-row] {
display: flex;
gap: 40px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using absolute values, use the global tokens instead var(--fs-spacing-6)

}
}

:first-child {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this working?

}
}

:first-child {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is working either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributing Pull request submitted by the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants