Skip to content

Commit

Permalink
MWPW-156612 fragment merch-card variant layouts (#2810)
Browse files Browse the repository at this point in the history
* MWPW-156612 fragment merch-card variant layouts

- move from merch-card.js code each layout code related to a given variant under variants/<variant> class
- move from global.css.js css related to a given variant under variants/<variant>.css.js
- move from merch-card.css.js wc css related to a given variant under variants/<variant>.variantStyle
- uses variants/variants as an index to get related class from related variant, and wc style too,
- uses variants/VariantLayout, superclass of all variants, to insert css if card is used, and hold common code

* MWPW-156612 changing title selector

to something independent of the layout (not initialized when used at first in collections)

* MWPW-156612 forking style insertion

* MWPW-156612 styles fixes

* MWPW-156612 review comments

* MWPW-156612 fixing unit tests

* MWPW-156612 address review comments

* MWPW-156612 catalog & image test cov

* MWPW-156612 100% coverage for variants

* MWPW-156612 fixing (again) ut

* MWPW-156612 fix one inline heading style

* MWPW-156612 bg img height
  • Loading branch information
npeltier authored Sep 12, 2024
1 parent 4357346 commit 6fa9558
Show file tree
Hide file tree
Showing 38 changed files with 4,015 additions and 3,567 deletions.
2,170 changes: 1,083 additions & 1,087 deletions libs/deps/mas/merch-card.js

Large diffs are not rendered by default.

747 changes: 3 additions & 744 deletions libs/deps/mas/plans-modal.js

Large diffs are not rendered by default.

750 changes: 4 additions & 746 deletions libs/features/mas/web-components/src/global.css.js

Large diffs are not rendered by default.

157 changes: 1 addition & 156 deletions libs/features/mas/web-components/src/merch-card.css.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css, unsafeCSS } from 'lit';
import { DESKTOP_UP, LARGE_DESKTOP, TABLET_UP, TABLET_DOWN } from './media.js';
import { DESKTOP_UP, LARGE_DESKTOP, TABLET_UP, } from './media.js';

export const styles = css`
:host {
Expand All @@ -20,26 +20,6 @@ export const styles = css`
visibility: hidden;
}
:host([variant='special-offers']) {
min-height: 439px;
}
:host([variant='catalog']) {
min-height: 330px;
}
:host([variant='plans']) {
min-height: 348px;
}
:host([variant='segment']) {
min-height: 214px;
}
:host([variant='ccd-action']:not([size])) {
width: var(--consonant-merch-card-ccd-action-width);
}
:host([aria-selected]) {
outline: none;
box-sizing: border-box;
Expand All @@ -61,10 +41,6 @@ export const styles = css`
background-image: var(--ellipsis-icon);
}
:host([variant='mini-compare-chart']) > slot:not([name='icons']) {
display: block;
}
.top-section {
display: flex;
justify-content: flex-start;
Expand Down Expand Up @@ -129,19 +105,6 @@ export const styles = css`
border-radius: 0 5px 5px 0;
}
.body .catalog-badge {
display: flex;
height: fit-content;
flex-direction: column;
width: fit-content;
max-width: 140px;
border-radius: 5px;
position: relative;
top: 0;
margin-left: var(--consonant-merch-spacing-xxs);
box-sizing: border-box;
}
.detail-bg-container {
right: 0;
padding: var(--consonant-merch-spacing-xs);
Expand Down Expand Up @@ -245,128 +208,10 @@ export const styles = css`
margin-top: 2px;
}
.twp-badge {
padding: 4px 10px 5px 10px;
}
:host([aria-selected]) .twp-badge {
margin-inline-end: 2px;
padding-inline-end: 9px;
}
:host([variant='twp']) {
padding: 4px 10px 5px 10px;
}
slot[name='icons'] {
display: flex;
gap: 8px;
}
:host([variant='twp']) ::slotted(merch-offer-select) {
display: none;
}
:host([variant='twp']) .top-section {
flex: 0;
display: flex;
flex-direction: column;
justify-content: flex-start;
height: 100%;
gap: var(--consonant-merch-spacing-xxs);
padding: var(--consonant-merch-spacing-xs)
var(--consonant-merch-spacing-xs) var(--consonant-merch-spacing-xs)
var(--consonant-merch-spacing-xs);
align-items: flex-start;
}
:host([variant='twp']) .body {
padding: 0 var(--consonant-merch-spacing-xs);
}
:host([variant='twp']) footer {
gap: var(--consonant-merch-spacing-xxs);
flex-direction: column;
align-self: flex-start;
}
:host([variant='special-offers'].center) {
text-align: center;
}
/* plans */
:host([variant='plans']) {
min-height: 348px;
}
:host([variant='mini-compare-chart']) footer {
min-height: var(--consonant-merch-card-mini-compare-footer-height);
padding: var(--consonant-merch-spacing-xs);
}
/* mini-compare card */
:host([variant='mini-compare-chart']) .top-section {
padding-top: var(--consonant-merch-spacing-s);
padding-inline-start: var(--consonant-merch-spacing-s);
height: var(--consonant-merch-card-mini-compare-top-section-height);
}
@media screen and ${unsafeCSS(TABLET_DOWN)} {
[class*'-merch-cards'] :host([variant='mini-compare-chart']) footer {
flex-direction: column;
align-items: stretch;
text-align: center;
}
}
@media screen and ${unsafeCSS(DESKTOP_UP)} {
:host([variant='mini-compare-chart']) footer {
padding: var(--consonant-merch-spacing-xs)
var(--consonant-merch-spacing-s)
var(--consonant-merch-spacing-s)
var(--consonant-merch-spacing-s);
}
}
:host([variant='mini-compare-chart']) slot[name='footer-rows'] {
flex: 1;
display: flex;
flex-direction: column;
justify-content: end;
}
/* mini-compare card heights for the slots: heading-m, body-m, heading-m-price, price-commitment, offers, promo-text, footer */
:host([variant='mini-compare-chart']) slot[name='heading-m'] {
min-height: var(--consonant-merch-card-mini-compare-heading-m-height);
}
:host([variant='mini-compare-chart']) slot[name='body-m'] {
min-height: var(--consonant-merch-card-mini-compare-body-m-height);
}
:host([variant='mini-compare-chart']) slot[name='heading-m-price'] {
min-height: var(
--consonant-merch-card-mini-compare-heading-m-price-height
);
}
:host([variant='mini-compare-chart']) slot[name='price-commitment'] {
min-height: var(
--consonant-merch-card-mini-compare-price-commitment-height
);
}
:host([variant='mini-compare-chart']) slot[name='offers'] {
min-height: var(--consonant-merch-card-mini-compare-offers-height);
}
:host([variant='mini-compare-chart']) slot[name='promo-text'] {
min-height: var(--consonant-merch-card-mini-compare-promo-text-height);
}
:host([variant='mini-compare-chart']) slot[name='callout-content'] {
min-height: var(
--consonant-merch-card-mini-compare-callout-content-height
);
}
:host([variant='plans']) ::slotted([slot='heading-xs']),
:host([variant='segment']) ::slotted([slot='heading-xs']) {
max-width: var(--consonant-merch-card-heading-xs-max-width, 100%);
}
`;

export const sizeStyles = () => {
Expand Down
Loading

0 comments on commit 6fa9558

Please sign in to comment.