Skip to content

Commit

Permalink
feat(pie-toast): DSW-2108 added styling for icons and isStrong modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
thejfreitas committed Jul 19, 2024
1 parent f706159 commit 6a48bed
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
13 changes: 11 additions & 2 deletions packages/components/pie-toast/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class PieToast extends RtlMixin(LitElement) implements ToastProps {

return html`
<pie-button
variant="ghost-inverse"
variant="${this.isVariantWarningAndIsStrong() ? 'ghost' : 'ghost-inverse'}"
size="xsmall"
aria-label="${ariaLabel || nothing}"
@click="${() => this.handleActionClick()}"
Expand Down Expand Up @@ -203,7 +203,7 @@ export class PieToast extends RtlMixin(LitElement) implements ToastProps {
private renderCloseButton (): TemplateResult {
return html`
<pie-icon-button
variant="ghost-inverse"
variant="${this.isVariantWarningAndIsStrong() ? 'ghost-secondary' : 'ghost-inverse'}"
size="xsmall"
data-test-id="${componentSelector}-close"
@click="${this.closeToastComponent}">
Expand Down Expand Up @@ -270,6 +270,15 @@ export class PieToast extends RtlMixin(LitElement) implements ToastProps {
return ['info', 'success', 'warning', 'error'].includes(variant);
}

/**
* util method that returns true if the variant is warning and is strong.
*
* @private
*/
private isVariantWarningAndIsStrong () {
return this.variant === 'warning' && this.isStrong;
}

render () {
const {
isOpen,
Expand Down
27 changes: 22 additions & 5 deletions packages/components/pie-toast/src/toast.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,40 @@
line-height: var(--toast-line-height);

&.variant-info {
--toast-icon-fill: var(--dt-color-support-info-02);
--toast-icon-fill: var(--dt-color-support-info-inverse);

&.is-strong {
--toast-background-color: var(--dt-color-blue);
--toast-background-color: var(--dt-color-support-info);
--toast-icon-fill: var(--dt-color-content-inverse);
}
}

&.variant-warning {
--toast-icon-fill: var(--dt-color-support-warning-02);
--toast-icon-fill: var(--dt-color-support-warning-inverse);

&.is-strong {
--toast-background-color: var(--dt-color-support-warning);
--toast-icon-fill: var(--dt-color-content-dark);
--toast-font-color: var(--dt-color-content-dark);
}
}

&.variant-success {
--toast-icon-fill: var(--dt-color-support-positive-02);
--toast-icon-fill: var(--dt-color-support-positive-inverse);

&.is-strong {
--toast-background-color: var(--dt-color-support-positive);
--toast-icon-fill: var(--dt-color-content-inverse);
}
}

&.variant-error {
--toast-icon-fill: var(--dt-color-support-error);
--toast-icon-fill: var(--dt-color-support-error-inverse);

&.is-strong {
--toast-background-color: var(--dt-color-support-error);
--toast-icon-fill: var(--dt-color-content-inverse);
}
}
}

Expand Down

0 comments on commit 6a48bed

Please sign in to comment.