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(accordion, accordion-item): add component tokens #8878

Merged
merged 7 commits into from
Mar 14, 2024

Conversation

alisonailea
Copy link
Contributor

Related Issue: #7180

Summary

Accordion

--calcite-accordion-background-color: defines the background color for the component and it's slotted accordion-items.
--calcite-accordion-border-color: defines the border color for the component and it's slotted accordion-items.

Accordion Item

--calcite-accordion-item-background-color: defines the background color for the component.
--calcite-accordion-item-border-color: defines the border color for the component.
--calcite-accordion-item-description-text-color: defines the text color of the description in the component. Falls back to --calcite-accordion-item-text-color.
--calcite-accordion-item-heading-text-color: defines the text color of the heading in the component. Falls back to --calcite-accordion-item-text-color.
--calcite-accordion-item-icon-color: defines the icon color for the component.
--calcite-accordion-item-expand-icon-color: defines the icon color for the component.
--calcite-accordion-item-text-color: defines the text color for the component.

@alisonailea alisonailea changed the base branch from main to epic/7180-component-tokens March 4, 2024 19:27
@github-actions github-actions bot added the enhancement Issues tied to a new feature or request. label Mar 4, 2024
Copy link
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

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

Looking good! 😎 I noticed a few things and also had a question regarding stateful CSS props.

}

.content {
padding: var(--calcite-accordion-item-padding);
padding: var(--calcite-internal-accordion-item-space-inset);
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick since this is internal, but shouldn't this be --calcite-internal-accordion-item-content-space?

Applies to other inset space CSS props.

margin-inline-start: var(--calcite-accordion-item-icon-spacing-start);
margin-inline-end: var(--calcite-accordion-item-icon-spacing-end);
transform: rotate(var(--calcite-accordion-item-icon-rotation));
margin-inline-start: var(--calcite-internal-accordion-item-icon-spacing-start);
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick since this is internal, but for consistency, these should use space vs spacing.

Also, since these are used for inline spacing, would --calcite-internal-accordion-item-icon-space-x-start/end be more appropriate?

& .heading {
@apply text-color-1;
color: var(
--calcite-accordion-item-heading-text-color,
Copy link
Member

Choose a reason for hiding this comment

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

Per our latest guidelines, should these be stateful CSS props?

component tokens should be added for the appropriate states as well. I.E. if background-color changes on hover then you should also add a background-color-hover token.

Applies to other CSS props affected by state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because all parts of the component respond to the state of the host, we don't need state tokens here.

*
* @prop --calcite-accordion-item-background-color: defines the background color for the component.
* @prop --calcite-accordion-item-border-color: defines the border color for the component.
* @prop --calcite-accordion-item-description-text-color: defines the text color of the description in the component. Falls back to `--calcite-accordion-item-text-color`.
Copy link
Member

Choose a reason for hiding this comment

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

For the time being, can we omit specifying which CSS prop it will fall back to? I think we could do so since it's an implementation detail.

border-block-end-width: var(--calcite-border-width-none);
border-style: solid;

::slotted(accordion-item) {
Copy link
Member

@jcfranco jcfranco Mar 6, 2024

Choose a reason for hiding this comment

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

Do we need to specify this if accordion items have these CSS props defined with the same fallback values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope! Thanks for the catch.

* These properties can be overridden using the component's tag as selector.
*
* @prop --calcite-accordion-item-background-color: defines the background color for the component.
* @prop --calcite-accordion-item-border-color: defines the border color for the component.
Copy link
Member

Choose a reason for hiding this comment

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

--calcite-accordion-item-border-color doesn't seem to be used in accordion-item's styling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the catch!


.accordion--transparent {
::slotted(accordion-item) {
--calcite-accordion-item-border-color: var(--calcite-accordion-border-color, transparent);
Copy link
Member

Choose a reason for hiding this comment

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

We should add a note to our guidelines about composite component overrides to slotted components.

@alisonailea alisonailea added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Mar 8, 2024
@alisonailea alisonailea requested a review from jcfranco March 14, 2024 00:20
@alisonailea alisonailea added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Mar 14, 2024
@alisonailea alisonailea added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Mar 14, 2024
@alisonailea alisonailea merged commit f72e632 into epic/7180-component-tokens Mar 14, 2024
8 checks passed
@alisonailea alisonailea deleted the astump/7180-accordion branch March 14, 2024 21:31
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. pr ready for visual snapshots Adding this label will run visual snapshot testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants