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

A4A > Marketplace: Product card redesign #98529

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Button } from '@automattic/components';
import { isEnabled } from '@automattic/calypso-config';
import { Button } from '@wordpress/components';
import { Icon, check } from '@wordpress/icons';
import clsx from 'clsx';
import { useTranslate } from 'i18n-calypso';
Expand Down Expand Up @@ -156,6 +157,8 @@ export default function MultiProductCard( props: Props ) {
return isSelected ? translate( 'Added to cart' ) : translate( 'Add to cart' );
}, [ asReferral, isSelected, translate ] );

const isRedesign = isEnabled( 'a4a-product-page-redesign' );

return (
<>
<div
Expand All @@ -175,14 +178,16 @@ export default function MultiProductCard( props: Props ) {
<div className="product-card__heading">
<h3 className="product-card__title">{ getProductShortTitle( product, true ) }</h3>

<MultipleChoiceQuestion
name={ `${ product.family_slug }-variant-options` }
question={ translate( 'Select variant:' ) }
answers={ variantOptions }
selectedAnswerId={ product.slug }
onAnswerChange={ onChangeOption }
shouldShuffleAnswers={ false }
/>
{ ! isRedesign && (
<MultipleChoiceQuestion
name={ `${ product.family_slug }-variant-options` }
question={ translate( 'Select variant:' ) }
answers={ variantOptions }
selectedAnswerId={ product.slug }
onAnswerChange={ onChangeOption }
shouldShuffleAnswers={ false }
/>
) }

<div className="product-card__pricing is-compact">
<ProductPriceWithDiscount
Expand All @@ -193,14 +198,25 @@ export default function MultiProductCard( props: Props ) {
/>
</div>

{ isRedesign && (
<MultipleChoiceQuestion
name={ `${ product.family_slug }-variant-options` }
question={ translate( 'Select variant:' ) }
answers={ variantOptions }
selectedAnswerId={ product.slug }
onAnswerChange={ onChangeOption }
shouldShuffleAnswers={ false }
/>
) }

<div className="product-card__description">{ productDescription }</div>
</div>
</div>
</div>
<div className="product-card__buttons">
<Button
className="product-card__select-button"
primary={ ! isSelected }
className={ clsx( { 'product-card__select-button': ! isRedesign } ) }
variant={ ! isSelected ? 'primary' : 'secondary' }
tabIndex={ -1 }
>
{ isSelected && <Icon icon={ check } /> }
Expand All @@ -211,6 +227,7 @@ export default function MultiProductCard( props: Props ) {
customText={ translate( 'View details' ) }
productName={ getProductShortTitle( product ) }
onClick={ onShowLightbox }
showIcon={ ! isRedesign }
/>
) }
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Button } from '@automattic/components';
import { isEnabled } from '@automattic/calypso-config';
import { Button } from '@wordpress/components';
import { Icon, check } from '@wordpress/icons';
import clsx from 'clsx';
import { useTranslate } from 'i18n-calypso';
Expand Down Expand Up @@ -130,6 +131,8 @@ export default function ProductCard( props: Props ) {
return isSelected ? translate( 'Remove from cart' ) : translate( 'Add to cart' );
}, [ asReferral, isSelected, translate ] );

const isRedesign = isEnabled( 'a4a-product-page-redesign' );

return (
<>
<div
Expand Down Expand Up @@ -167,8 +170,8 @@ export default function ProductCard( props: Props ) {
</div>
<div className="product-card__buttons">
<Button
className="product-card__select-button"
primary={ ! isSelected }
className={ clsx( { 'product-card__select-button': ! isRedesign } ) }
variant={ ! isSelected ? 'primary' : 'secondary' }
tabIndex={ -1 }
>
{ isSelected && <Icon icon={ check } /> }
Expand All @@ -179,6 +182,7 @@ export default function ProductCard( props: Props ) {
customText={ translate( 'View details' ) }
productName={ productTitle }
onClick={ onShowLightbox }
showIcon={ ! isRedesign }
/>
) }
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,66 @@
}
}

.products-overview-v2 {
.product-card__heading {
gap: 12px;
}

.product-card__inner {
border-radius: 8px; /* stylelint-disable-line scales/radii */
border-color: #ddd;
padding: 16px;
}

.product-card__title {
// TODO: Replace with Heading LG
font-size: rem(15px);
font-weight: 500;
line-height: 1.3;
}

.product-price-with-discount__price {
// TODO: Replace with Heading XL
font-size: rem(20px);
font-weight: 500;
line-height: 1.2;
}

.product-price-with-discount__price-interval {
// TODO: Replace with Body MD
font-size: rem(13px);
font-weight: 400;
line-height: 1.5;
}

.product-card__pricing {
margin: 0;
}

.product-card__description {
// TODO: Replace with Body LG
font-size: rem(15px);
font-weight: 400;
line-height: 1.6;

color: var(--color-neutral-80);
margin: 0;
}

// TODO: Create a new component for
// this on A4A when we remove the feature flag
.license-lightbox-link {
font-size: rem(13px);
font-weight: 400;
line-height: 1.5;
text-decoration: none;
color: var(--color-primary);
}
}

.product-card__types {
display: flex;
gap: 0.5rem;
margin-block-start: 4px;
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ type Props = {
productName: string;
customText?: string;
onClick: ( e: React.MouseEvent< HTMLElement > ) => void;
showIcon?: boolean;
};

const LicenseLightboxLink: FunctionComponent< Props > = ( {
productName,
customText,
onClick,
showIcon = true,
} ) => {
const translate = useTranslate();

Expand All @@ -37,7 +39,7 @@ const LicenseLightboxLink: FunctionComponent< Props > = ( {
} ) }
</span>

<img className="license-lightbox-link-icon" src={ ModalLinkIcon } alt="" />
{ showIcon && <img className="license-lightbox-link-icon" src={ ModalLinkIcon } alt="" /> }
</Button>
);
};
Expand Down
Loading