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

Design token value map #104

Closed
blackfalcon opened this issue Nov 17, 2022 · 3 comments
Closed

Design token value map #104

blackfalcon opened this issue Nov 17, 2022 · 3 comments
Assignees

Comments

@blackfalcon
Copy link
Member

blackfalcon commented Nov 17, 2022

Is your feature request related to a problem? Please describe.

Switching a theme should be as easy as swapping out one design token lib for another. The problem is that the SCSS for the auro-button element's SCSS uses tokens directly as the value per CSS property.

  // auro-button--tertiary
  &--tertiary {
    background-color: var(--auro-color-background-lighter);
    border-color: var(--auro-color-ui-default-on-light);
    box-shadow: inset 0 0 0 3px var(--auro-color-ui-default-on-light);
  }

Describe the solution you'd like

A proposed solution is to create a mapping from any pre-defined list of design tokens to a more generic set of values. A possible solution is to use fallback values.

  // auro-button--tertiary
  &--tertiary {
    background-color: var(--auro-color-background-lighter, var(--airstream-color-background-lighter));
    border-color: var(--auro-color-ui-default-on-light, var(--airstream-color-ui-default-on-light));
    box-shadow: inset 0 0 0 3px var(--auro-color-ui-default-on-light, var(--airstream-color-ui-default-on-light));
  }

While this simplifies the addition of the different themes, this also means that we need to update individual element SCSS if there are changes.

Another way to consider this is to have a single map.scss file that uses a fallback method to redefine the value of generically used tokens. It is also recommended that the mapping of these values is not contained per custom element. This should be a global resource that is subscribed to.

It is assumed that we could create this from the tokens repo.

:root {
  --color-background-lighter: var(--auro-color-background-lighter, var(--airstream-color-background-lighter))
  --color-ui-default-on-light: var(--auro-color-ui-default-on-light, var(--airstream-color-ui-default-on-light))
}

Then the SCSS would be the following.

  // auro-button--tertiary
  &--tertiary {
    background-color: var(--color-background-lighter);
    border-color: var(--color-ui-default-on-light);
  }

Exit criteria

For this issue to be closed, a user must be able to subscribe to an alternate set of design tokens and HTML custom elements within the scope of that project will change themes based on those tokens.

Dependency

@blackfalcon blackfalcon added Type: Feature New Feature not-reviewed Issue has not been reviewed by Auro team members labels Nov 17, 2022
@leeejune
Copy link
Contributor

@braven112 braven112 removed the not-reviewed Issue has not been reviewed by Auro team members label Nov 17, 2022
@jordanjones243
Copy link
Contributor

After discussion with @jason-capsule42, we feel as though auro-input would be a better component to use for design token value mapping. The reason behind this is that auro-button is an older component that uses the imports for Sass properties and variables to build out a CSS variable file. While auro-input directly imports the Custom CSS tokens directly onto its demo page, easily allowing for us to switch between this import and any other theming imports with simple JS.

@jordanjones243
Copy link
Contributor

Refer to this new ticket in auro-input to continue the design token value mapping discussion:

@blackfalcon blackfalcon added the not-reviewed Issue has not been reviewed by Auro team members label Jan 20, 2023
@blackfalcon blackfalcon transferred this issue from AlaskaAirlines/auro-button Feb 17, 2023
@blackfalcon blackfalcon removed the not-reviewed Issue has not been reviewed by Auro team members label Mar 8, 2023
@blackfalcon blackfalcon self-assigned this Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants