Skip to content

Commit

Permalink
feat: implement tier 3 token structure #121
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanjones243 committed Aug 8, 2024
1 parent e32e501 commit 874e9ce
Show file tree
Hide file tree
Showing 12 changed files with 147 additions and 51 deletions.
21 changes: 21 additions & 0 deletions demo/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,24 @@ Explanation and use description.
```
<!-- AURO-GENERATED-CONTENT:END -->
</auro-accordion>

### Theme Support

The component may be restyled using the following code sample and changing the values of the following token(s).

<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../../src/tokens.scss) -->
<!-- The below code snippet is automatically added from ./../../src/tokens.scss -->

```scss
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables';

:host {
--ds-auro-flight-footer-text-color: var(--ds-color-text-secondary-default, #{$ds-color-text-secondary-default});
--ds-auro-flight-header-days-changed-text-color: var(--ds-color-utility-error-default, #{$ds-color-utility-error-default});
--ds-auro-flight-header-text-color: var(--ds-color-text-secondary-default, #{$ds-color-text-secondary-default});
--ds-auro-flight-cancelled-station-text-color: var(--ds-color-utility-error-default, #{$ds-color-utility-error-default});
--ds-auro-flight-station-text-color: var(--ds-color-text-secondary-default, #{$ds-color-text-secondary-default});
--ds-auro-flight-time-text-color: var(--ds-color-text-primary-default, #{$ds-color-text-primary-default});
}
```
<!-- AURO-GENERATED-CONTENT:END -->
8 changes: 8 additions & 0 deletions docs/partials/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,11 @@ Explanation and use description.

</auro-accordion>


### Theme Support

The component may be restyled using the following code sample and changing the values of the following token(s).

<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../../src/tokens.scss) -->
<!-- AURO-GENERATED-CONTENT:END -->

14 changes: 10 additions & 4 deletions src/auro-flight-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
// If use litElement base class
import { LitElement, html, css } from "lit";
import { getDateDifference } from "../util/util.js";
import styleCss from "./style-flight-header-css.js";

import styleFlightHeaderCss from "./style-flight-header-css.js";
import colorFlightHeaderCss from "./color-flight-header-css.js";
import tokensCss from "./tokens-css.js";


// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
/**
Expand Down Expand Up @@ -35,9 +39,11 @@ export class AuroFlightHeader extends LitElement {
}

static get styles() {
return css`
${styleCss}
`;
return [
css`${styleFlightHeaderCss}`,
css`${colorFlightHeaderCss}`,
css`${tokensCss}`
];
}

/**
Expand Down
14 changes: 10 additions & 4 deletions src/auro-flight-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

// If use litElement base class
import { LitElement, html, css } from "lit";
import styleCss from "./style-flight-main-css.js";

import styleFlightMainCss from "./style-flight-main-css.js";
import colorFlightMainCss from "./color-flight-main-css.js";
import tokensCss from "./tokens-css.js";

import { getDateDifference } from './../util/util.js';

// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
Expand Down Expand Up @@ -46,9 +50,11 @@ export class AuroFlightMain extends LitElement {
}

static get styles() {
return css`
${styleCss}
`;
return [
css`${styleFlightMainCss}`,
css`${colorFlightMainCss}`,
css`${tokensCss}`,
];
}

constructor() {
Expand Down
12 changes: 9 additions & 3 deletions src/auro-flight.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
// If use litElement base class
import { LitElement, html, css } from "lit";
import styleCss from "./style-flight-css.js";
import colorFlightCss from "./color-flight-css.js";
import tokensCss from "./tokens-css.js";

import "@aurodesignsystem/auro-flightline";
import "@aurodesignsystem/auro-flightline/src/auro-flight-segment.js";

import "./auro-flight-header.js";
import "./auro-flight-main.js";

Expand Down Expand Up @@ -51,9 +55,11 @@ export class AuroFlight extends LitElement {
}

static get styles() {
return css`
${styleCss}
`;
return [
css`${styleCss}`,
css`${colorFlightCss}`,
css`${tokensCss}`
];
}

// This function removes a CSS selector if the footer slot is empty
Expand Down
19 changes: 19 additions & 0 deletions src/color-flight-header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2024 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
// See LICENSE in the project root for license information.

// ---------------------------------------------------------------------

// Import Auro tokens
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables';

@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/breakpoints';
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/core';
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/utilityClasses/displayProperties';

:host {
color: var(--ds-auro-flight-header-text-color);
}

.daysChanged {
color: var(--ds-auro-flight-header-days-changed-text-color);
}
33 changes: 33 additions & 0 deletions src/color-flight-main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) 2024 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
// See LICENSE in the project root for license information.

// ---------------------------------------------------------------------

/* stylelint-disable selector-class-pattern */

// Import Auro tokens
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables';

@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/breakpoints';
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/core';
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/utilityClasses/displayProperties';

.departureTime {
color: var(--ds-auro-flight-main-time-text-color);
}

.departureStation {
color: var(--ds-auro-flight-main-station-text-color);
}

.arrivalTime {
color: var(--ds-auro-flight-main-time-text-color);
}

.arrivalStation {
color: var(--ds-auro-flight-main-station-text-color);
}

.util_lineThrough {
color: var(--ds-auro-flight-main-cancelled-station-text-color);
}
15 changes: 15 additions & 0 deletions src/color-flight.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) 2024 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
// See LICENSE in the project root for license information.

// ---------------------------------------------------------------------

// Import Auro tokens
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables';

@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/breakpoints';
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/core';
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/utilityClasses/displayProperties';

[name='footer'] {
color: var(--ds-auro-flight-footer-text-color);
}
21 changes: 0 additions & 21 deletions src/style-flight-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,18 @@
// Import Auro tokens
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables';

// Support for fallback values
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables.scss';

@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/breakpoints';
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/core';
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/utilityClasses/displayProperties';

// Support for auroElement styles
// @import './../node_modules/@aurodesignsystem/webcorestylesheets/dist/auroElement/auroElement';

// container styles - defines the look of the outer custom component
// :host {
// ...
// }

// layout styles - define any layout specifications for UI that is contained WITHIN the component
// never define layout that would cause effect on element outside the scope of this component

// component shape styles
// .auro-flight {
// ...
// }

:host {
display: flex;
justify-content: space-between;
padding-bottom: var(--ds-size-50, $ds-size-50);
color: var(--ds-color-text-secondary-default, $ds-color-text-secondary-default);
font-size: var(--ds-text-body-size-default, $ds-text-body-size-default);
}

.daysChanged {
align-self: flex-end;
padding-left: var(--ds-text-body-size-xs, $ds-text-body-size-xs);
color: var(--ds-color-alert-error-default, $ds-color-alert-error-default);
}
24 changes: 12 additions & 12 deletions src/style-flight-main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@

// ---------------------------------------------------------------------

/* stylelint-disable selector-class-pattern, scss/percent-placeholder-pattern */

// Import Auro tokens
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables';

@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/breakpoints';
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/core';
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/utilityClasses/displayProperties';

%flightTimeStyles {
padding-bottom: var(--ds-size-25, $ds-size-25);
font-size: var(--ds-text-heading-300-size, $ds-text-heading-300-size);
line-height: var(--ds-text-heading-700-height-breakpoint-md, $ds-text-heading-700-height-breakpoint-md);
}

:host {
display: flex;
flex-direction: row;
Expand All @@ -24,28 +32,22 @@
}

.departureTime {
padding-bottom: var(--ds-size-25, $ds-size-25);
color: var(--ds-color-text-primary-default, $ds-color-text-primary-default);
font-size: var(--ds-text-heading-300-size, $ds-text-heading-300-size);
line-height: var(--ds-text-heading-700-height-breakpoint-md, $ds-text-heading-700-height-breakpoint-md);
@extend %flightTimeStyles;

text-align: left;
}

.departureStation {
color: var(--ds-color-text-secondary-default, $ds-color-text-secondary-default);
text-align: left;
}

.arrivalTime {
padding-bottom: var(--ds-size-25, $ds-size-25);
color: var(--ds-color-text-primary-default, $ds-color-text-primary-default);
font-size: var(--ds-text-heading-300-size, $ds-text-heading-300-size);
line-height: var(--ds-text-heading-700-height-breakpoint-md, $ds-text-heading-700-height-breakpoint-md);
@extend %flightTimeStyles;

text-align: right;
}

.arrivalStation {
color: var(--ds-color-text-secondary-default, $ds-color-text-secondary-default);
text-align: right;
}

Expand All @@ -55,10 +57,8 @@
flex-direction: column;
}

/* stylelint-disable */
.util_lineThrough {
padding-right: var(--ds-size-200, $ds-size-200);
color: var(--ds-color-alert-error-default, $ds-color-alert-error-default);
text-decoration: line-through;
}

Expand Down
7 changes: 0 additions & 7 deletions src/style-flight.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,10 @@
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/core';
@import './../node_modules/@aurodesignsystem/webcorestylesheets/src/utilityClasses/displayProperties';

// Support for fallback values
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables.scss';

.flightFooter {
padding-top: var(--ds-size-200, $ds-size-200);
}

[name='footer'] {
color: var(--ds-color-text-secondary-default, $ds-color-text-secondary-default);
}

.headerContainer {
display: flex;
justify-content: space-between;
Expand Down
10 changes: 10 additions & 0 deletions src/tokens.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables';

:host {
--ds-auro-flight-footer-text-color: var(--ds-color-text-secondary-default, #{$ds-color-text-secondary-default});
--ds-auro-flight-header-days-changed-text-color: var(--ds-color-utility-error-default, #{$ds-color-utility-error-default});
--ds-auro-flight-header-text-color: var(--ds-color-text-secondary-default, #{$ds-color-text-secondary-default});
--ds-auro-flight-cancelled-station-text-color: var(--ds-color-utility-error-default, #{$ds-color-utility-error-default});
--ds-auro-flight-station-text-color: var(--ds-color-text-secondary-default, #{$ds-color-text-secondary-default});
--ds-auro-flight-time-text-color: var(--ds-color-text-primary-default, #{$ds-color-text-primary-default});
}

0 comments on commit 874e9ce

Please sign in to comment.