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

feat(checkout): CHECKOUT-000 Add spans for product-title, product-item-quantity, product-option-label, and product-option-value #1701

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bc-0dp
Copy link
Collaborator

@bc-0dp bc-0dp commented Feb 16, 2024

What?

As requested by community members here, #1700
we've added wrapping spans around product quantity and product title, as well as adding wrapping spans around product options label and value in the cart-summary.

Why?

This improves customization options for developers as they can target these values now purely with CSS

Testing / Proof

Screenshot 2024-02-16 at 11 55 05 Screenshot 2024-02-16 at 11 51 50

@bigcommerce/team-checkout

…m-quantity, product-option-label, and product-option-value
@@ -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

@@ -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

…m-quantity, product-option-label, and product-option-value
@bc-0dp bc-0dp marked this pull request as ready for review February 21, 2024 11:31
@bc-0dp bc-0dp requested a review from a team as a code owner February 21, 2024 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants