Skip to content

Commit

Permalink
fix: (CXSPA-1109) - Styles of links for cart table items (#18750)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdrozdsap authored Apr 25, 2024
1 parent 88a26ac commit 493a413
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from '@spartacus/cart/base/root';
import { ICON_TYPE } from '@spartacus/storefront';
import { CartItemContextSource } from './model/cart-item-context-source.model';
import { useFeatureStyles } from '@spartacus/core';

@Component({
selector: 'cx-cart-item',
Expand Down Expand Up @@ -42,7 +43,9 @@ export class CartItemComponent implements OnChanges {
iconTypes = ICON_TYPE;
readonly CartOutlets = CartOutlets;

constructor(protected cartItemContextSource: CartItemContextSource) {}
constructor(protected cartItemContextSource: CartItemContextSource) {
useFeatureStyles('a11yCartItemsLinksStyles');
}

ngOnChanges(changes?: SimpleChanges) {
if (changes?.compact) {
Expand Down
6 changes: 6 additions & 0 deletions feature-libs/cart/base/styles/components/_cart-item-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
text-decoration: none;
color: var(--cx-color-text);
font-weight: var(--cx-font-weight-bold);

// TODO: (CXSPA-6903) - Remove feature flag next major release
@include forFeature('a11yCartItemsLinksStyles') {
text-decoration: underline;
color: var(--cx-color-primary);
}
}

.cx-total {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { UntypedFormControl } from '@angular/forms';
import { OrderEntry } from '@spartacus/cart/base/root';
import { QuickOrderFacade } from '@spartacus/cart/quick-order/root';
import { useFeatureStyles } from '@spartacus/core';
import { Subscription } from 'rxjs';

@Component({
Expand Down Expand Up @@ -48,7 +49,9 @@ export class QuickOrderItemComponent implements OnInit, OnDestroy {
constructor(
protected cd: ChangeDetectorRef,
protected quickOrderService: QuickOrderFacade
) {}
) {
useFeatureStyles('a11yCartItemsLinksStyles');
}

ngOnInit(): void {
this.subscription.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
SimpleChanges,
} from '@angular/core';
import { OrderEntry } from '@spartacus/cart/base/root';
import { Product } from '@spartacus/core';
import { Product, useFeatureStyles } from '@spartacus/core';
import {
ProductListItemContext,
ProductListItemContextSource,
Expand Down Expand Up @@ -42,7 +42,9 @@ export class WishListItemComponent implements OnChanges {

constructor(
protected productListItemContextSource: ProductListItemContextSource
) {}
) {
useFeatureStyles('a11yCartItemsLinksStyles');
}

ngOnChanges(changes?: SimpleChanges): void {
if (changes?.cartEntry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ export interface FeatureTogglesInterface {
* Corrects heading order inside 'OrderSummaryComponent' template.
*/
a11yCartSummaryHeadingOrder?: boolean;

/**
* When set to `true`, product titles in `CartItemComponent`, `QuickOrderItemComponent`, `WishListItemComponent`
* adopt a more link-like style, appearing blue with an underline. This enhances visual cues for clickable elements,
* providing a more intuitive user experience.
*/
a11yCartItemsLinksStyles?: boolean;
}

export const defaultFeatureToggles: Required<FeatureTogglesInterface> = {
Expand Down Expand Up @@ -181,4 +188,5 @@ export const defaultFeatureToggles: Required<FeatureTogglesInterface> = {
a11yListOversizedFocus: false,
a11yStoreFinderOverflow: false,
a11yCartSummaryHeadingOrder: false,
a11yCartItemsLinksStyles: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ if (environment.requestedDeliveryDate) {
a11yListOversizedFocus: true,
a11yStoreFinderOverflow: true,
a11yCartSummaryHeadingOrder: true,
a11yCartItemsLinksStyles: true,
};
return appFeatureToggles;
}),
Expand Down

0 comments on commit 493a413

Please sign in to comment.