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

MWPW-158473: CCD Suggested Card [Merch card] #2927

Closed
wants to merge 60 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
29a16b0
initial commit
Axelcureno Sep 17, 2024
cd361b9
slots, styles and basic layout
Axelcureno Sep 18, 2024
d47b6ff
more changes
Axelcureno Sep 19, 2024
1894a7a
Update merch-card.ccd-suggested.test.html
Axelcureno Sep 19, 2024
eb40fb4
Update merch-twp-d2p.test.html
Axelcureno Sep 19, 2024
329be3a
unit tests, strip slot and more
Axelcureno Sep 19, 2024
0b1aef8
fixed review comments
Axelcureno Sep 23, 2024
e20123a
review comments fixed
Axelcureno Sep 23, 2024
f545c53
Merge branch 'stage' into MWPW-158473
Axelcureno Sep 24, 2024
254ef7a
Merge branch 'stage' into MWPW-158473
Axelcureno Sep 24, 2024
937713f
RTL background image support
Axelcureno Sep 24, 2024
59285a0
Initial @adobecom/mas-js version.
yesil Sep 26, 2024
1dd8ea9
a
Axelcureno Sep 30, 2024
5e5924d
Update merch-card.ccd-suggested.test.html
Axelcureno Sep 30, 2024
eb156cc
a
Axelcureno Sep 30, 2024
5302051
dark mode, unit tests and rtl
Axelcureno Oct 1, 2024
bdf845d
simplified styles
Axelcureno Oct 1, 2024
d2b50c4
Merge branch 'stage' into MWPW-158473
Axelcureno Oct 1, 2024
bdd6322
updated deps
Axelcureno Oct 1, 2024
d8eb9e9
Update variant-layout.js
Axelcureno Oct 1, 2024
d1ba823
dark theme ut
Axelcureno Oct 1, 2024
fed743d
Update merch-card.ccd-suggested.test.html.js
Axelcureno Oct 1, 2024
48d5fc4
Update variant-layout.js
Axelcureno Oct 1, 2024
a7ac03d
card mapping
Axelcureno Oct 2, 2024
0aa1042
MWPW-158200: Merch card Dark mode
Axelcureno Oct 2, 2024
521ac4e
updated deps
Axelcureno Oct 2, 2024
b2e797e
MWPW-159257 refactor mas enablement
npeltier Oct 4, 2024
d07b721
MWPW-159257 fix unit test + register co
npeltier Oct 4, 2024
cd61ece
review comments fixed
Axelcureno Oct 4, 2024
54dd79d
MWPW-159257 some feedbacks, more coverage
npeltier Oct 6, 2024
f5c38d3
draft
npeltier Oct 7, 2024
aff1f4a
Merge remote-tracking branch 'upstream/stage' into MWPW-157288
yesil Oct 8, 2024
046f140
Merge branch 'MWPW-158200' of github.com:adobecom/milo into MWPW-157288
yesil Oct 8, 2024
b5ef73c
Merge branch 'MWPW-158473' of github.com:adobecom/milo into MWPW-157288
yesil Oct 8, 2024
8069853
bump pkg version
yesil Oct 8, 2024
2f47a9d
MWPW-160085: WIP
yesil Oct 8, 2024
181a47d
wip
yesil Oct 9, 2024
0f39d38
fix cta mapping for suggested card
yesil Oct 9, 2024
a77246f
ccd-suggested fixes
yesil Oct 9, 2024
53faa8d
dark theme update
yesil Oct 9, 2024
1bd7cd7
remove css var
yesil Oct 9, 2024
bf98d49
fix size attribute in hydrate
yesil Oct 9, 2024
d697854
Merge branch 'MWPW-157288' into MWPW-160085
yesil Oct 9, 2024
5f6c4dd
MWPW-159257 remove init & reset concept
npeltier Oct 8, 2024
7d3b828
update docs
yesil Oct 9, 2024
fb50fdc
Merge branch 'fur-ilyas' of github.com:npeltier/milo into MWPW-160085
yesil Oct 10, 2024
dd9b869
merge changes, add more docs
yesil Oct 10, 2024
f179e09
update docs
yesil Oct 10, 2024
f8fcef8
update docs
yesil Oct 10, 2024
655afb4
fix docu
3ch023 Oct 10, 2024
13fe806
add ccd test page
3ch023 Oct 11, 2024
755e6e6
update ccd gallery
3ch023 Oct 14, 2024
fb07228
add dark theme
3ch023 Oct 14, 2024
c6d7712
fix fragment test init
npeltier Oct 15, 2024
2c73de1
Merge branch 'ccd' of github.com:adobecom/milo into ccd
npeltier Oct 15, 2024
eae4854
add vpn banner
3ch023 Oct 15, 2024
2fd5647
fixed fragment mapping
Axelcureno Oct 15, 2024
5b8bdf6
Update merch-card.js
Axelcureno Oct 15, 2024
2ddea92
Update mas.js
Axelcureno Oct 15, 2024
619f690
Merge branch 'ccd' into MWPW-158473
Axelcureno Oct 15, 2024
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
3 changes: 3 additions & 0 deletions libs/features/mas/web-components/src/global.css.js
Axelcureno marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ styles.innerHTML = `
--consonant-merch-card-cta-font-size: 15px;

/* headings */
--consonant-merch-card-heading-xxs-font-size: 16px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, let's not use --consonant prefix for CCD cards are they are not meant to be one.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed consonant prefix

--consonant-merch-card-heading-xxs-line-height: 20px;
--consonant-merch-card-heading-xs-font-size: 18px;
--consonant-merch-card-heading-xs-line-height: 22.5px;
--consonant-merch-card-heading-s-font-size: 20px;
Expand Down Expand Up @@ -68,6 +70,7 @@ styles.innerHTML = `
--consonant-merch-card-border-color: #eaeaea;
--color-accent: #1473E6;
--merch-color-focus-ring: #1473E6;
--merch-color-grey-60: #6D6D6D;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use corresponding spectrum variable and fallback to #6D6D6D; ?
Thus, it should work with dark theme automatically.

Copy link
Member Author

Choose a reason for hiding this comment

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

using the spectrum var inside merch var and the hex value as fallback didn't work. But I changed the reference to use spectrum var and hex as fallback directly in the selectors that use it.

--merch-color-grey-80: #2c2c2c;
--merch-color-green-promo: #2D9D78;

Expand Down
2 changes: 2 additions & 0 deletions libs/features/mas/web-components/src/merch-card.js
Axelcureno marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class MerchCard extends LitElement {
type: String,
attribute: 'badge-background-color',
},
stripSize: { type: String, attribute: 'strip-size' },
stripBackground: { type: String, attribute: 'strip-background' },
badgeText: { type: String, attribute: 'badge-text' },
actionMenu: { type: Boolean, attribute: 'action-menu' },
actionMenuContent: { type: String, attribute: 'action-menu-content' },
Expand Down
8 changes: 8 additions & 0 deletions libs/features/mas/web-components/src/merch-datasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const VARIANTS = {
AH: 'ah',
CCD_ACTION: 'ccd-action',
SPECIAL_OFFERS: 'special-offers',
CCD_SUGGESTED: 'ccd-suggested',
};

const cardContent = {
Expand Down Expand Up @@ -37,6 +38,13 @@ const cardContent = {
description: { tag: 'div', slot: 'body-xs' },
ctas: { size: 'l' },
},
[VARIANTS.CCD_SUGGESTED]: {
name: { tag: 'h4', slot: 'detail-m' },
title: { tag: 'h3', slot: 'heading-xs' },
prices: { tag: 'h3', slot: 'heading-xs' },
description: { tag: 'div', slot: 'body-xs' },
ctas: { size: 'l' },
},
};

async function parseMerchCard(fragmentData, appendFn, merchCard, consonant) {
Expand Down
38 changes: 38 additions & 0 deletions libs/features/mas/web-components/src/variants/ccd-suggested.css.js
Axelcureno marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export const CSS = `
:root {
--consonant-merch-card-ccd-suggested-width: 304px;
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to adopt --merch-card-ccd-* for ccd cards.
@npeltier thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

i was thinking that we do need some rules indeed :)
we'll soon have to introduce concept of surface anyway, and i was wondering if with that in mind we still do need to put CCD in our names & variables

--consonant-merch-card-ccd-suggested-height: 205px;
--consonant-merch-card-ccd-suggested-background-img-size: 119px;
}

merch-card[variant="ccd-suggested"] [slot='detail-m'] {
color: var(--merch-color-grey-60);
}

merch-card[variant="ccd-suggested"] [slot='icons'] {
flex-flow: wrap;
place-self: flex-start;
}

merch-card[variant="ccd-suggested"] [slot='heading-xs'] {
font-size: var(--consonant-merch-card-heading-xxs-font-size);
line-height: var(--consonant-merch-card-heading-xxs-line-height);

}
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be part of the card CSS, rather than the document's

Copy link
Member Author

Choose a reason for hiding this comment

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

There is a problem with doing what you suggest: Global styles override VariantLayout styles. I suggest we discuss how to proceed with this in our tech call but it wouldn't hurt to leave it as is in the meantime.
Screenshot 2024-10-01 at 1 26 49 PM


merch-card[variant="ccd-suggested"] [slot='price'] {
display: flex;
align-items: center;
}

merch-card[variant="ccd-suggested"] [slot='cta'] {
display: flex;
align-items: center;
}
Axelcureno marked this conversation as resolved.
Show resolved Hide resolved

merch-card[variant="ccd-suggested"] [slot='cta'] a {
text-decoration: none;
color: var(--merch-color-grey-60);
font-weight: 500;
}
`;
81 changes: 81 additions & 0 deletions libs/features/mas/web-components/src/variants/ccd-suggested.js
Axelcureno marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { html, css } from 'lit';
import { VariantLayout } from './variant-layout';
import { CSS } from './ccd-suggested.css.js';

export class CCDSuggested extends VariantLayout {
constructor(card) {
super(card);
}

Axelcureno marked this conversation as resolved.
Show resolved Hide resolved
getGlobalCSS() {
return CSS;
}

renderLayout () {
return html`
<div style="${this.stripStyle}" class="body">
<div class="top-secton">
<slot name="icons"></slot>
<div class="header">
<slot name="detail-m"></slot>
<slot name="heading-xs"></slot>
</div>
</div>
<slot name="body-xs"></slot>
<div class="footer">
<slot name="price"></slot>
<slot name="cta"></slot>
</div>
</div>
<slot></slot>`;
}

static variantStyle = css`
:host([variant='ccd-suggested']) {
width: var(--consonant-merch-card-ccd-suggested-width);
min-height: var(--consonant-merch-card-ccd-suggested-height);
border-radius: 4px;
display: flex;
flex-flow: wrap;
}

:host([variant='ccd-suggested']) .body {
height: auto;
}

:host([variant='ccd-suggested']) .top-secton {
display: flex;
flex-flow: wrap;
place-self: flex-start;
}

:host([variant='ccd-suggested']) .header {
padding-inline-start: var(--consonant-merch-spacing-xxs);
}

:host([variant='ccd-suggested'][strip-size='small']) {
width:
}

:host([variant='ccd-suggested'][strip-size='wide']) ::slotted([slot='body-xs']) {
padding-inline-start: 48px;
}

:host([variant='ccd-suggested'][strip-size='wide']) ::slotted([slot='price']) {
padding-inline-start: 48px;
}

:host([variant='ccd-suggested']) slot[name='detail-m'] {
flex-flow: wrap;
place-self: flex-start;
}

:host([variant='ccd-suggested']) .footer {
display: flex;
justify-content: space-between;
flex-grow: 0;
margin-top: auto;
align-items: center;
}
`;
};
28 changes: 28 additions & 0 deletions libs/features/mas/web-components/src/variants/variant-layout.js
Axelcureno marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,34 @@
get headingSelector() {
return '[slot="heading-xs"]';
}



get strip() {
if (this.card.stripSize && this.card.stripBackground) {
switch (this.card.stripSize) {
case 'wide':
return '44px';
case 'small':
return '4px';
default:
return '0';

Check warning on line 77 in libs/features/mas/web-components/src/variants/variant-layout.js

View check run for this annotation

Codecov / codecov/patch

libs/features/mas/web-components/src/variants/variant-layout.js#L77

Added line #L77 was not covered by tests
}
}
return '';
}

get stripStyle() {
if (this.strip && this.card.stripBackground) {
return `
background: ${this.card.stripBackground.startsWith('url') ? this.card.stripBackground : `url("${this.card.stripBackground}")`};
background-size: ${this.strip} 100%;
background-repeat: no-repeat;
background-position: left;
`;
}
return '';
}

get secureLabelFooter() {
const secureLabel = this.card.secureLabel
Expand Down
4 changes: 4 additions & 0 deletions libs/features/mas/web-components/src/variants/variants.js
Axelcureno marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Product } from './product.js';
import { Segment } from './segment.js';
import { SpecialOffer } from './special-offer.js';
import { TWP } from './twp.js';
import { CCDSuggested } from './ccd-suggested.js';

const getVariantLayout = (card) => {
switch (card.variant) {
Expand All @@ -31,6 +32,8 @@ const getVariantLayout = (card) => {
return new SpecialOffer(card);
case 'twp':
return new TWP(card);
case 'ccd-suggested':
return new CCDSuggested(card);
default:
return new Product(card);
}
Expand All @@ -45,6 +48,7 @@ const getVariantStyles = () => {
styles.push(Segment.variantStyle);
styles.push(SpecialOffer.variantStyle);
styles.push(TWP.variantStyle);
styles.push(CCDSuggested.variantStyle);
return styles;
}

Expand Down
Axelcureno marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading