-
Notifications
You must be signed in to change notification settings - Fork 76
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(tile): add design tokens #10476
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Erik! Looking good. I have a few suggestions to ensure we keep the component aligned to current design patterns.
@ashetland can you confirm "heading" "description/text" align with the future cross-component heading patterns?
var(--calcite-color-text-3) | ||
); | ||
--calcite-internal-tile-heading-text-color: var(--calcite-tile-heading-text-color, var(--calcite-color-text-2)); | ||
--calcite-internal-tile-icon-color: var(--calcite-color-text-3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's confusing to set all the -internal
variable defaults here. Rather defaults should be set as the final fallback on the style prop itself.
@@ -7,42 +7,65 @@ | |||
* @prop --calcite-tile-border-color: Specifies the border color of the component. | |||
* @prop --calcite-tile-description-text-color: Specifies the description text color of the component. | |||
* @prop --calcite-tile-heading-text-color: Specifies the heading text color of the component. | |||
* @prop --calcite-tile-icon-color: Specifies the icon color in the component. | |||
* @prop --calcite-tile-selection-icon-color: Specifies the color of the selection icon in the component. | |||
* @prop --calcite-tile-selection-icon-color-hover: Specifies the color of the selection icon in the component on hover. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
replace all three icon tokens and the "tile-description" with
--calcite-tile-text-color
and --calcite-tile-color-selected
which covers the states and retains the overall design pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would a user override the icon color separately from the title or description text? Just --calcite-icon-color?
Wouldn't it be more expected to use --calcite-tile-icon-color
for the display icon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because Tile now uses an actual calcite-icon
for the radio and checkbox UI, the meaning of "icon" easily generates confusion too because there's the "selection" icon (radio or checkbox) and the "content" icon that displays above the heading. @macandcheese which icon are you referring to here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content one. I thought the original set you had here made the most sense, just IMO - to your point it makes the distinction between selection icon more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
Per some other discussions, like a more general "close-button" pattern I think there is a more global "selection-icon" pattern that we could use. As for the tile-icon, what about something like the following?
calcite-icon {
color: var(--calcite-title-icon-color, var(--calcite-icon-color, currentColor));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that looks good. I think the “selection-“ prefix does make it kind of clear and we use it elsewhere, so agreed with some consistent naming there it’s not as bad.
I don’t think using component specific naming is an issue there - even when we have the global overrides I think we’d want publicly documented component-specific ones.
.selection-icon-example-class {
color: var(--calcite-title-selection-icon-color, var(--calcite-selection-icon-color, “whatever underlying default”));
}
Having these at the component level even if there are underlying higher level props makes documentation easier as well IMO. Users won’t need to track down these possible properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed!
.selection-icon-example-class {
color: var(--calcite-title-selection-icon-color, var(--calcite-selection-icon-color, “whatever underlying default”));
}
looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I reading that right? Should it be --calcite-tile-icon-color ?
@@ -189,6 +218,8 @@ | |||
:host([selection-appearance="border"][layout="horizontal"]), | |||
:host([selection-appearance="border"][layout="vertical"]) { | |||
.container.selected:focus::before { | |||
--calcite-internal-tile-shadow: inset 0 0 0 1px var(--calcite-color-brand); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--calcite-internal-tile-shadow-color: var(--calcite-tile-color-selected, var(--calcite-color-brand));
@@ -202,21 +233,28 @@ | |||
|
|||
:host([selection-appearance="border"][layout="horizontal"]) { | |||
.container.selected { | |||
box-shadow: inset 0 -4px 0 0 var(--calcite-color-brand); | |||
--calcite-internal-tile-shadow: inset 0 -4px 0 0 var(--calcite-color-brand); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change this back to a static style prop
box-shadow: inset 0 -4px 0 0 var(--calcite-internal-tile-shadow-color, var(--calcite-color-brand));
} | ||
} | ||
|
||
:host([selection-appearance="border"][layout="vertical"]) { | ||
.container.selected { | ||
box-shadow: inset 4px 0 0 0 var(--calcite-color-brand); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only the "x" and "y" axis lengths are in changing between these box-shadows. You could probably simplify this down to a single style prop. Something like....
.container {
box-shadow: inset var(--calcite-internal-tile-shadow-x) var(--calcite-internal-tile-shadow-y) 0 0 var(--calcite-internal-tile-shadow-color, none);
}
:host([selection-appearance="border"]) .container.selected {
--calcite-internal-tile-shadow-color: var(--calcite-tile-color-selected, var(--calcite-color-brand));
}
:host([layout="vertical"]) .container {
--calcite-internal-tile-shadow-x: 4px;
--calcite-internal-tile-shadow-y: 0;
}
:host([layout="horizontal"]) .container {
--calcite-internal-tile-shadow-x: 0;
--calcite-internal-tile-shadow-y: -4px;
}
--calcite-internal-tile-border-color: var(--calcite-color-text-link); | ||
--calcite-internal-tile-heading-text-color: var(--calcite-color-text-link); | ||
--calcite-internal-tile-icon-color: var(--calcite-color-text-link); | ||
--calcite-ui-icon-color: var(--calcite-color-text-link); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ui-icon-color
is deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if removing this would constitute a breaking change or not, so I hesitate to remove that. All of these changes straight-up copied over from the tokens branch, so my guess is this is here for a reason to prevent a breakage. Unless we're ok with breaking changes on these PRs, I suppose it would be fine to remove it. @jcfranco thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the --calcite-ui-icon-color
is deprecated but still available on the calcite-icon however it is overwritten by --calcite-icon-color
. However we don't just want to replace --calcite-ui-icon-color
with --calcite-icon-color
in this case because that's not how we're styling calcite-icon as a sub-component in other components.
Instead this should be something like the following.
calcite-icon {
color: var(--calcite-tile-href-icon-color, var(--calcite-color-text-link));
}
--calcite-icon-color: var(--calcite-color-text-link); | ||
--calcite-internal-tile-border-color: var(--calcite-color-text-link); | ||
--calcite-internal-tile-heading-text-color: var(--calcite-color-text-link); | ||
--calcite-internal-tile-icon-color: var(--calcite-color-text-link); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to add an extra token for this case --calcite-title-href-text-color
:host([href]:focus:not([disabled])),
:host([href]:hover:not([disabled])) {
.container,
.heading {
color: var(--calcite-title-href-text-color, var(--calcite-color-text-link));
}
.container {
border-color: var(--calcite-title-href-text-color, var(--calcite-color-text-link));
}
}
…xt-color-hover" token to allow both a default and overridable hover color.
@@ -5,8 +5,9 @@ | |||
* | |||
* @prop --calcite-tile-background-color: Specifies the background color of the component. | |||
* @prop --calcite-tile-border-color: Specifies the border color of the component. | |||
* @prop --calcite-tile-description-text-color: Specifies the description text color of the component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we still want this? There are two different colors used for the heading / description UI ... I'd expect a css property to individually control each. cc @ashetland @SkyeSeitz to confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alisonailea 's suggestion is simply to replace --calcite-tile-description-text-color
with --calcite-tile-text-color
which effectively serves as like the "body" default text color, and because it is applied to the host element instead of the .container
div.description
div, it will set a color for the whole content of the tile, including icons and other content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description and heading are different colors currently and will remain different colors in future Tile enhancements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there isn’t a default content slot, I’d expect the css props to match the property name for each.
Other content is slotted in. This is why I still think the “icon prop” would have its own css property.
As a user without knowledge of the component, setting the icon to the description color is confusing (or, having description / icon be text-color but then also having a “named” text color property for heading).
…ender this unnecessary and we don't want to ship a token we'll have to immediately deprecate
…so that one color token controls both the unfocused and focused states
…irectly on a calcite-tile element selector in CSS
… Restoring selection-appearance border selected styles with box-shadow rules.
…internal-tile-border-color and using brand token for hover, focus states on borders
…calcite-tile-heading-text-color-hover
…way of setting the color of the presentation calcite-icon using a direct color property, and adding additional --calcite-tile-href-icon-color-hover token that defaults to the link color
Related Issue: #7180
Summary
Adds design tokens for the Tile component.
--calcite-tile-background-color: Specifies the background color of the component.
--calcite-tile-border-color: Specifies the border color of the component.
--calcite-tile-description-text-color: Specifies the description text color of the component.
--calcite-tile-heading-text-color: Specifies the heading text color of the component.
--calcite-tile-icon-color: Specifies the icon color in the component.
--calcite-tile-selection-icon-color: Specifies the color of the selection icon in the component.
--calcite-tile-selection-icon-color-hover: Specifies the color of the selection icon in the component on hover.
--calcite-tile-shadow: Specifies the box-shadow of the component.