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(rating): add component tokens #11150

Merged
merged 11 commits into from
Jan 7, 2025

Conversation

aPreciado88
Copy link
Contributor

@aPreciado88 aPreciado88 commented Dec 27, 2024

Related Issue: #7180

Summary

Add rating component tokens.

--calcite-rating-spacing: Specifies the amount of left and right margin spacing between each item.
--calcite-rating-color-hover: Specifies the component's item color when hovered or selected.
--calcite-rating-color: Specifies the component's item color.
--calcite-rating-average-color: Specifies the component's item color when average is set.
--calcite-rating-average-text-color: Specifies the component's average text color.
--calcite-rating-count-text-color: Specifies the component's count text color.

@github-actions github-actions bot added the enhancement Issues tied to a new feature or request. label Dec 27, 2024
@@ -4,6 +4,11 @@
* These properties can be overridden using the component's tag as selector.
*
* @prop --calcite-rating-spacing-unit: The amount of left and right margin spacing between each rating star.
* @prop --calcite-rating-hover-selected-color: Specifies the component's color when hovered and selected.
Copy link
Member

Choose a reason for hiding this comment

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

I think the order of this should be --calcite-rating-selected-color-hover right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated this to --calcite-rating-selected-color-hover

@@ -4,6 +4,11 @@
* These properties can be overridden using the component's tag as selector.
*
* @prop --calcite-rating-spacing-unit: The amount of left and right margin spacing between each rating star.
* @prop --calcite-rating-hover-selected-color: Specifies the component's color when hovered and selected.
* @prop --calcite-rating-idle-unselected-color: Specifies the component's color when idle and unselected.
Copy link
Member

Choose a reason for hiding this comment

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

Can this just be --calcite-rating-color? Or does it need to specify idle and unselected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated this token to --calcite-rating-color.

targetProp: "color",
},
});
});
Copy link
Member

Choose a reason for hiding this comment

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

Can you add tests for the other vars?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added tests for the other tokens. I'm having issues testing --calcite-rating-spacing, could you please take a look?
cc @driskull @alisonailea

@@ -3,7 +3,12 @@
*
* These properties can be overridden using the component's tag as selector.
*
* @prop --calcite-rating-spacing-unit: The amount of left and right margin spacing between each rating star.
* @prop --calcite-rating-spacing-unit: Specifies the amount of left and right margin spacing between each item.
Copy link
Contributor

Choose a reason for hiding this comment

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

deprecate in favor of --calcite-rating-spacing

@@ -3,7 +3,12 @@
*
* These properties can be overridden using the component's tag as selector.
*
* @prop --calcite-rating-spacing-unit: The amount of left and right margin spacing between each rating star.
* @prop --calcite-rating-spacing-unit: Specifies the amount of left and right margin spacing between each item.
* @prop --calcite-rating-selected-color-hover: Specifies the component's item color when hovered or selected.
Copy link
Contributor

Choose a reason for hiding this comment

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

--calcite-rating-color-hover

@@ -84,13 +89,14 @@ calcite-chip {

.number--average {
font-weight: bold;
color: var(--calcite-rating-average-text-color);
Copy link
Contributor

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 token?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It sets the average text color, I set it to purple in this example. Should I remove this token?

image

@@ -15,17 +20,17 @@

:host([scale="s"]) {
@apply h-6;
--calcite-rating-spacing-unit: theme("spacing.1");
--spacing: theme("spacing.1");
Copy link
Contributor

Choose a reason for hiding this comment

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

tokens should not be assigned in the component unless they are tagged with -internal-

}

:host([scale="m"]) {
@apply h-8;
--calcite-rating-spacing-unit: theme("spacing.2");
--spacing: theme("spacing.2");
Copy link
Contributor

Choose a reason for hiding this comment

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

tokens should not be assigned in the component unless they are tagged with -internal-

}

:host([scale="l"]) {
@apply h-11;
--calcite-rating-spacing-unit: theme("spacing.3");
--spacing: theme("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.

tokens should not be assigned in the component unless they are tagged with -internal-

@aPreciado88 aPreciado88 marked this pull request as ready for review January 3, 2025 18:30
@aPreciado88 aPreciado88 added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Jan 4, 2025
@aPreciado88
Copy link
Contributor Author

@ashetland @SkyeSeitz Can you please take a look at the snapshots?

@ashetland
Copy link
Contributor

Lookin' good. Normal false positives.

@aPreciado88 aPreciado88 added skip visual snapshots Pull requests that do not need visual regression testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Jan 7, 2025
@aPreciado88 aPreciado88 merged commit 6dbb559 into dev Jan 7, 2025
13 checks passed
@aPreciado88 aPreciado88 deleted the aPreciado88/7180-add-rating-design-tokens branch January 7, 2025 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues tied to a new feature or request. skip visual snapshots Pull requests that do not need visual regression testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants