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(tile): add design tokens #10476

Open
wants to merge 20 commits into
base: dev
Choose a base branch
from
Open

Conversation

eriklharper
Copy link
Contributor

@eriklharper eriklharper commented Oct 2, 2024

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-description-text-color-hover: Specifies the description text color of the component on hover.
--calcite-tile-heading-text-color: Specifies the heading text color of the component.
--calcite-tile-heading-text-color-hover: Specifies the heading text color of the component on hover.
--calcite-tile-href-icon-color-hover: Specifies the icon color of the component when using a href on hover.
--calcite-tile-icon-color: Specifies the icon color in the component.
--calcite-tile-selection-color: Specifies the color of the component's selection indicators (radio, checkbox, border) when using a selection-mode that allows selection.
--calcite-tile-selection-color-hover: Specifies the selected/hover/focus color of the component's selection indicators (radio, checkbox, border) when using a selection-mode that allows selection.
--calcite-tile-shadow: Specifies the shadow around the component.

@github-actions github-actions bot added the enhancement Issues tied to a new feature or request. label Oct 2, 2024
@eriklharper eriklharper marked this pull request as ready for review October 2, 2024 22:48
@eriklharper eriklharper requested review from alisonailea and jcfranco and removed request for jcfranco and benelan October 2, 2024 22:48
Copy link
Contributor

@alisonailea alisonailea left a 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?

packages/calcite-components/src/components/tile/tile.scss Outdated Show resolved Hide resolved
packages/calcite-components/src/components/tile/tile.scss Outdated Show resolved Hide resolved
packages/calcite-components/src/components/tile/tile.scss Outdated Show resolved Hide resolved
packages/calcite-components/src/components/tile/tile.scss Outdated Show resolved Hide resolved
packages/calcite-components/src/components/tile/tile.scss Outdated Show resolved Hide resolved
packages/calcite-components/src/components/tile/tile.scss Outdated Show resolved Hide resolved
packages/calcite-components/src/components/tile/tile.scss Outdated Show resolved Hide resolved
}
}

:host([selection-appearance="border"][layout="vertical"]) {
.container.selected {
box-shadow: inset 4px 0 0 0 var(--calcite-color-brand);
Copy link
Contributor

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;
}

packages/calcite-components/src/components/tile/tile.scss Outdated Show resolved Hide resolved
--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);
Copy link
Contributor

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.
…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
…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
…le-description-text-color, syncing up all current css properties in tests and demos, commenting out some tests that need fixed in a follow-up
…ption-text-color-hover token with correct fallback, refactoring icon selectors to use css classes instead of element selectors, fixing heading text hover color, updating tests and demos, adding a link token test for heading text and icon hover
…cite-tile-selection-color/hover just like Card does.
…able for selected, hover and focus states instead of the base one. This allows for the base color of the selection icon to be controlled separately from selected/hover/focus state. Not sure if this is the right thing to do, need to follow up
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants