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(card): component tokens #10161

Merged
merged 12 commits into from
Aug 28, 2024
Merged

feat(card): component tokens #10161

merged 12 commits into from
Aug 28, 2024

Conversation

alisonailea
Copy link
Contributor

@alisonailea alisonailea commented Aug 26, 2024

Related Issue: #7180

Summary

Removes some extraneous background color tokens and merges color and icon tokens to align with the design pattern. This also resolves an icon issue discovered in #10062

Tokens

--calcite-card-accent-color-selected: Specifies the accent color of the component when selected.
--calcite-card-background-color: Specifies the background color of the component.
--calcite-card-border-color: Specifies the border color of the component.
--calcite-card-corner-radius: Specifies the corner radius of the component.
--calcite-card-selection-background-color-hover: Specifies the background color of the component's selection element when hovered.
--calcite-card-selection-background-color-press: Specifies the background color of the component's selection element when active.
--calcite-card-selection-color-hover: Specifies the color of the component's selection element when hovered or focused.
--calcite-card-selection-color: Specifies the color of the component's selection element.
--calcite-card-shadow: Specifies the shadow of the component.

Deprecated

--calcite-card-selection-background-color-active: Use --calcite-card-selection-background-color-press. Specifies the background color of the component's selection element when active.
--calcite-card-selection-background-color-selected: Use --calcite-card-background-color. Specifies the icon color of the component's selection element when selected.
--calcite-card-selection-background-color: Use --calcite-card-background-color. Specifies the background color of the component's selection element.
--calcite-card-selection-icon-color-hover: Use --calcite-card-selection-color-hover. Specifies the icon color of the component's selection element when hovered.
--calcite-card-selection-icon-color-selected: Use --calcite-card-accent-color-selected. Specifies the icon color of the component's selection element when selected.
--calcite-card-selection-icon-color: Use --calcite-card-selection-color. Specifies the icon color of the component's selection element.

@alisonailea alisonailea self-assigned this Aug 26, 2024
@github-actions github-actions bot added the enhancement Issues tied to a new feature or request. label Aug 26, 2024
* @prop --calcite-card-selection-background-color-active: [Deprecated] Specifies the background color of the component's selection element when active.
* @prop --calcite-card-selection-background-color-hover: [Deprecated] Specifies the background color of the component's selection element when hovered.
* @prop --calcite-card-selection-background-color-selected: [Deprecated] Specifies the icon color of the component's selection element when `selected`.
* @prop --calcite-card-selection-background-color: [Deprecated] Specifies the background color of the component's selection element.
Copy link
Contributor

Choose a reason for hiding this comment

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

I’m still not sure why we are removing most of these. How would a user change the color of this internally rendered element? Applies to most of these deprecations.

Copy link
Contributor

Choose a reason for hiding this comment

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

It prevents what is a very common use case for tokens in my mind, something like this:
Screenshot 2024-08-26 at 9 09 46 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are background colors are for for transparent design pattern behind icons that creates a shading effect. Unless there is a specific user request edge case to break this design pattern there is no need to provide these tokens.

Copy link
Contributor

@macandcheese macandcheese Aug 26, 2024

Choose a reason for hiding this comment

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

I think those underlying values should probably use fg-2, fg-3, not -color-transparent. I believe that may have been a holdover from when they were positioned over a thumbnail (?).

As a designer for the above design though, I'd want to be able to control those.

Choose a reason for hiding this comment

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

I would agree we should use fg-2, fg-3, not -color-transparent & having control over the above seems reasonable.

Copy link
Member

@driskull driskull left a comment

Choose a reason for hiding this comment

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

LGTM!

@alisonailea alisonailea added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Aug 26, 2024
* @prop --calcite-card-selection-color-hover: Specifies the color of the component's selection element when hovered or focused.
* @prop --calcite-card-selection-background-color-active: [Deprecated] Use --calcite-card-background-color-press. Specifies the background color of the component's selection element when active.
* @prop --calcite-card-selection-background-color-hover: [Deprecated] --calcite-card-background-color-hover. Specifies the background color of the component's selection element when hovered.
* @prop --calcite-card-selection-background-color-selected: [Deprecated] Use --calcite-card-background-color. Specifies the icon color of the component's selection element when `selected`.
Copy link
Contributor

@macandcheese macandcheese Aug 27, 2024

Choose a reason for hiding this comment

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

Are these still intended to be deprecated?

I would not expect to use “—calcite-card-background-color” to control the background color of the internal “checkbox element” like this deprecation message suggests.

The newly introduced names are confusing to me, there is no general hover or press state or interaction case for a Card component itself, those states should be applied separately via css prop imo. If a user wants to set calcite-card:hover { whatever } they can do so, but this internally rendered element is different.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

  1. the checkbox component should probably control it's own hover styles anyway
  2. this is added style complexity which breaks our existing design patterns unless there is a current user request use case I don't know about.
  3. While the entire card background doesn't change there is a design pattern of foreground-1 for default, foreground-2 for hover, and foreground-3 for active, which is basically what we are doing. The goal is not to recreate CSS styling or JS props with CSS variables but to create a baseline set of styles which allow flexibility while maintaining our styling cadence. Naming every sub-element in a component with it's own set of variables when changing only the styles of that one element would break the design pattern without cause is an anti-pattern IMO

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not actually a checkbox component - it's just a styled div with an icon as it is in most other selection-enabled components.

The design I posted above with the multiple selection cards is a real-world use case I'd like to achieve (and is currently possible) - so removing these would prevent that design. We shouldn't be arbiters of theming choices - if we are truly making our components fully them able via tokens, everything should be theme able, not just what some deem appropriate.

I think this proposed nomenclature is more confusing - there is no hover state for the card - and we want folks to use stateful overrides (:hover, etc.) for actual parent-level adjustments based on those interactions right?

IMO setting --calcite-card-background-color-hover to control the bg of a portion of the card doesn't make sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if we are truly making our components fully them able via tokens, everything should be theme able, not just what some deem appropriate.

This is not what we have discussed as a team. What we are providing is white labeling. We still have design patterns we have set and want to adhere to. That said, I can understand your argument against --calcite-card-background-color-hover, I've updated the tokens. Is this an acceptable compromise?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good

@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 Aug 27, 2024
…openPR/7180-card

# Conflicts:
#	packages/calcite-components/src/components/card/card.scss
@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 Aug 27, 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 Aug 27, 2024
@alisonailea alisonailea merged commit 08578a3 into dev Aug 28, 2024
15 checks passed
@alisonailea alisonailea deleted the astump/7180-card branch August 28, 2024 20:20
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.

4 participants