Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/core/src/app/order/OrderSummaryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export interface OrderSummaryItemProps {

export interface OrderSummaryItemOption {
testId: string;
content: ReactNode;
content?: ReactNode;
optionLabel?: ReactNode;
optionValue?: ReactNode;
}

const OrderSummaryItem: FunctionComponent<OrderSummaryItemProps> = ({
Expand All @@ -37,7 +39,8 @@ const OrderSummaryItem: FunctionComponent<OrderSummaryItemProps> = ({
className="product-title optimizedCheckout-contentPrimary"
data-test="cart-item-product-title"
>
{`${quantity} x ${name}`}
<span className="product-item-quantity">{quantity}</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to change this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically no. But the community elaborated, and mentioned that it's the same improvement and would be nice to be able to target qty and name separately as well. Enabling dev's to style those individually with CSS without the need to introduce JS to do so

<span className="product-item-name">{name}</span>
</h4>
{productOptions && productOptions.length > 0 && (
<ul
Expand All @@ -46,7 +49,8 @@ const OrderSummaryItem: FunctionComponent<OrderSummaryItemProps> = ({
>
{productOptions.map((option, index) => (
<li className="product-option" data-test={option.testId} key={index}>
{option.content}
<span className="product-option-label">{option.optionLabel}</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a check here for content, just in case for customisations? Something like

{Boolean(content) ? 
    {option.content} : 
    <>
       <span className="product-option-label">{option.optionLabel}</span>
       <span className="product-option-value">{option.optionValue}</span>
    </>
 }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

option.content is removed all together from the product options and replaced by optionLabel and optionValue

<span className="product-option-value">{option.optionValue}</span>
</li>
))}
</ul>
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/app/order/mapFromDigital.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function mapFromDigital(item: DigitalItem): OrderSummaryItemProps {
productOptions: [
...(item.options || []).map((option) => ({
testId: 'cart-item-product-option',
content: `${option.name} ${option.value}`,
optionLabel: `${option.name}`,
optionValue: `${option.value}`,
})),
getDigitalItemDescription(item),
],
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/app/order/mapFromPhysical.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ function mapFromPhysical(item: PhysicalItem): OrderSummaryItemProps {
description: item.giftWrapping ? item.giftWrapping.name : undefined,
productOptions: (item.options || []).map((option) => ({
testId: 'cart-item-product-option',
content: `${option.name} ${option.value}`,
optionLabel: `${option.name}`,
optionValue: `${option.value}`,
})),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,24 @@

.product-title {
margin-bottom: spacing("eighth");

.product-item-quantity::after {
content: ' x ';
}
}

.product-options {
color: color("greys");
font-size: fontSize("tiny");
margin: 0;

.product-option-label {
font-weight: fontWeight("bold");

&::after {
content: ' ';
}
}
}

.product-description {
Expand Down