Skip to content

feat: add rating field - #2636

Merged
hellofanny merged 11 commits into
mainfrom
feat/add-rating-field
Feb 13, 2025
Merged

hellofanny merged 11 commits into
mainfrom
feat/add-rating-field

Conversation

@artursantiago

@artursantiago artursantiago commented Jan 28, 2025 •

Copy link
Copy Markdown
Contributor

⚠️ THIS PR DEPENDS ON PR#2635 ⚠️

What's the purpose of this pull request?

This pull request adds the RatingField component, which will initially be used in the modal for adding reviews to a product.

How it works?

This PR creates a new molecule component called RatingField. In addition to the "input" fields for the actionable rating, it can also receive an id, label, and error via props to be displayed in the form. The component uses the Rating component with the actionable view, passing the onChange handler to it.

How to test it?

Starters Deploy Preview

Preview

References

JIRA TASK: SFS-2078
JIRA TASK: SFS-2077

Figma

image

image

@artursantiago artursantiago added enhancement New feature or request depends on Depends on another PR - Please mention the PR labels Jan 28, 2025
@codesandbox-ci

codesandbox-ci Bot commented Jan 28, 2025 •

Copy link
Copy Markdown

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.

@vercel

vercel Bot commented Jan 28, 2025

Copy link
Copy Markdown

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:47am

@artursantiago artursantiago self-assigned this Jan 28, 2025
@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 renatamottam and renatomaurovtex and removed request for a team January 30, 2025 17:43
@artursantiago

Copy link
Copy Markdown
Contributor Author

@hellofanny

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

@hellofanny hellofanny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work 🚀 ! We just need to tweak a few more details. 👍

// --------------------------------------------------------
// Structural Styles
// --------------------------------------------------------

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

todo: fix the button size, it's currently 48px, and should be 32px.

image

I will suggest adding a new token:

// Button
--fs-rating-button-min-height: var(--fs-spacing-5);

and then on line 34, force the size:

[data-fs-rating-button] {
 --fs-button-small-min-height: var(--fs-rating-button-min-height);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alright, I've implemented the suggested change, I had previously kept the token value because I thought it was something set for accessibility, so as not to make the touch area so small

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually, it is! In this case, I believe the design team considers 24px as the minimum target size. @renatamottam

@hellofanny hellofanny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@hellofanny
hellofanny merged commit f6ab024 into main Feb 13, 2025
@hellofanny
hellofanny deleted the feat/add-rating-field branch February 13, 2025 19:54
artursantiago added a commit that referenced this pull request Feb 14, 2025
>⚠️ THIS PR DEPENDS ON
[PR#2635](#2635) ⚠️

## What's the purpose of this pull request?

This pull request adds the RatingField component, which will initially
be used in the modal for adding reviews to a product.

## How it works?

This PR creates a new molecule component called `RatingField`. In
addition to the "input" fields for the actionable rating, it can also
receive an `id`, `label`, and `error` via props to be displayed in the
form. The component uses the `Rating` component with the `actionable`
view, passing the `onChange` handler to it.

## How to test it?

<!--- Describe the steps with bullet points. Is there any external link
that can be used to better test it or an example? --->

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->


[Preview](https://starter-git-feat-rating-field-vtex.vercel.app//review-and-ratings-playground)

## References

[JIRA TASK: SFS-2078](https://vtex-dev.atlassian.net/browse/SFS-2078)
[JIRA TASK: SFS-2077](https://vtex-dev.atlassian.net/browse/SFS-2077)


[Figma](https://www.figma.com/design/YXU6IX2htN2yg7udpCumZv/Reviews-%26-Ratings?node-id=131-49445&t=iOanfcOwmDa4bolf-4)


![image](https://github.com/user-attachments/assets/56da1a26-1764-489c-90e9-2d81275715c3)


![image](https://github.com/user-attachments/assets/8351c008-3fca-4e36-ad6d-30518e005dbb)

---------

Co-authored-by: Fanny Chien <[email protected]>
Co-authored-by: Fanny Chien <[email protected]>
artursantiago added a commit that referenced this pull request Feb 14, 2025
>⚠️ THIS PR DEPENDS ON
[PR#2635](#2635) ⚠️

## What's the purpose of this pull request?

This pull request adds the RatingField component, which will initially
be used in the modal for adding reviews to a product.

## How it works?

This PR creates a new molecule component called `RatingField`. In
addition to the "input" fields for the actionable rating, it can also
receive an `id`, `label`, and `error` via props to be displayed in the
form. The component uses the `Rating` component with the `actionable`
view, passing the `onChange` handler to it.

## How to test it?

<!--- Describe the steps with bullet points. Is there any external link
that can be used to better test it or an example? --->

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->


[Preview](https://starter-git-feat-rating-field-vtex.vercel.app//review-and-ratings-playground)

## References

[JIRA TASK: SFS-2078](https://vtex-dev.atlassian.net/browse/SFS-2078)
[JIRA TASK: SFS-2077](https://vtex-dev.atlassian.net/browse/SFS-2077)


[Figma](https://www.figma.com/design/YXU6IX2htN2yg7udpCumZv/Reviews-%26-Ratings?node-id=131-49445&t=iOanfcOwmDa4bolf-4)


![image](https://github.com/user-attachments/assets/56da1a26-1764-489c-90e9-2d81275715c3)


![image](https://github.com/user-attachments/assets/8351c008-3fca-4e36-ad6d-30518e005dbb)

---------

Co-authored-by: Fanny Chien <[email protected]>
Co-authored-by: Fanny Chien <[email protected]>
artursantiago added a commit that referenced this pull request Feb 14, 2025
>⚠️ THIS PR DEPENDS ON
[PR#2635](#2635) ⚠️

## What's the purpose of this pull request?

This pull request adds the RatingField component, which will initially
be used in the modal for adding reviews to a product.

## How it works?

This PR creates a new molecule component called `RatingField`. In
addition to the "input" fields for the actionable rating, it can also
receive an `id`, `label`, and `error` via props to be displayed in the
form. The component uses the `Rating` component with the `actionable`
view, passing the `onChange` handler to it.

## How to test it?

<!--- Describe the steps with bullet points. Is there any external link
that can be used to better test it or an example? --->

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->


[Preview](https://starter-git-feat-rating-field-vtex.vercel.app//review-and-ratings-playground)

## References

[JIRA TASK: SFS-2078](https://vtex-dev.atlassian.net/browse/SFS-2078)
[JIRA TASK: SFS-2077](https://vtex-dev.atlassian.net/browse/SFS-2077)


[Figma](https://www.figma.com/design/YXU6IX2htN2yg7udpCumZv/Reviews-%26-Ratings?node-id=131-49445&t=iOanfcOwmDa4bolf-4)


![image](https://github.com/user-attachments/assets/56da1a26-1764-489c-90e9-2d81275715c3)


![image](https://github.com/user-attachments/assets/8351c008-3fca-4e36-ad6d-30518e005dbb)

---------

Co-authored-by: Fanny Chien <[email protected]>
Co-authored-by: Fanny Chien <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

depends on Depends on another PR - Please mention the PR enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants