-
Notifications
You must be signed in to change notification settings - Fork 181
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-158053: CCD Slice Card [Merch card] #2878
Changes from all commits
03778dd
7ead9eb
a8ab869
b9580d5
6df1623
6c3cb8f
5ad2935
9aa3eee
bc3ae26
49b3acd
950c3ae
ed4137a
afaf7ff
95698c4
ae57a05
3a656a7
8273f59
cdb6c8c
f30355d
f84c67c
b174f0d
3e9ed08
2b04688
17a18a1
1139b0f
c3289a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
Large diffs are not rendered by default.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export const CSS = ` | ||
:root { | ||
--consonant-merch-card-ccd-slice-single-width: 322px; | ||
--consonant-merch-card-ccd-slice-icon-size: 30px; | ||
--consonant-merch-card-ccd-slice-wide-width: 600px; | ||
--consonant-merch-card-ccd-slice-single-height: 154px; | ||
--consonant-merch-card-ccd-slice-background-img-size: 119px; | ||
} | ||
|
||
merch-card[variant="ccd-slice"] [slot='body-s'] a:not(.con-button) { | ||
font-size: var(--consonant-merch-card-body-xxs-font-size); | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: var(--consonant-merch-card-body-xxs-line-height); | ||
text-decoration-line: underline; | ||
color: var(--merch-color-grey-80); | ||
} | ||
|
||
merch-card[variant="ccd-slice"] [slot='image'] img { | ||
overflow: hidden; | ||
border-radius: 50%; | ||
} | ||
`; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { VariantLayout } from './variant-layout.js'; | ||
import { html, css } from 'lit'; | ||
import { CSS } from './ccd-slice.css.js'; | ||
|
||
export class CCDSlice extends VariantLayout { | ||
|
||
getGlobalCSS() { | ||
return CSS; | ||
} | ||
|
||
renderLayout() { | ||
return html` <div class="content"> | ||
<slot name="icons"></slot> ${this.badge} | ||
<slot name="body-s"></slot> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: this should be body-xs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or merch-datasource that should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have fixed in merch-datasource, thank you. |
||
<slot name="footer"></slot> | ||
</div> | ||
<slot name="image"></slot> | ||
<slot></slot>`; | ||
} | ||
|
||
static variantStyle = css` | ||
:host([variant='ccd-slice']) { | ||
width: var(--consonant-merch-card-ccd-slice-single-width); | ||
border-radius: 4px; | ||
display: flex; | ||
flex-flow: wrap; | ||
} | ||
|
||
:host([variant='ccd-slice']) ::slotted([slot='body-s']) { | ||
font-size: var(--consonant-merch-card-body-xs-font-size); | ||
line-height: var(--consonant-merch-card-body-xxs-line-height); | ||
} | ||
|
||
:host([variant='ccd-slice'][size='wide']) { | ||
width: var(--consonant-merch-card-ccd-slice-wide-width); | ||
} | ||
|
||
:host([variant='ccd-slice']) .content { | ||
display: flex; | ||
gap: var(--consonant-merch-spacing-xxs); | ||
padding: var(--consonant-merch-spacing-xs); | ||
padding-inline-end: 0; | ||
width: 154px; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
align-items: flex-start; | ||
flex: 1 0 0; | ||
} | ||
|
||
:host([variant='ccd-slice']) ::slotted([slot='body-s']) ::slotted(a:not(.con-button)) { | ||
font-size: var(--consonant-merch-card-body-xxs-font-size); | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: var(--consonant-merch-card-body-xxs-line-height); | ||
text-decoration-line: underline; | ||
color: var(--merch-color-grey-80); | ||
} | ||
|
||
:host([variant='ccd-slice']) ::slotted([slot='image']) { | ||
display: flex; | ||
justify-content: center; | ||
flex-shrink: 0; | ||
width: var(--consonant-merch-card-ccd-slice-background-img-size); | ||
height: var(--consonant-merch-card-ccd-slice-background-img-size); | ||
overflow: hidden; | ||
border-radius: 50%; | ||
padding: var(--consonant-merch-spacing-xs); | ||
align-self: center; | ||
} | ||
|
||
:host([variant='ccd-slice']) ::slotted([slot='image']) img { | ||
overflow: hidden; | ||
border-radius: 50%; | ||
width: inherit; | ||
height: inherit; | ||
} | ||
`; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Merch Card CCD SliceWeb Component demo page</title> | ||
<script> | ||
window.process = { | ||
env: {}, | ||
}; | ||
</script> | ||
<style> | ||
main { | ||
display: flex; | ||
align-items: center; | ||
gap: 20px; | ||
flex-direction: column; | ||
padding-top: 80px; | ||
} | ||
|
||
</style> | ||
</head> | ||
|
||
<body> | ||
<script type="module" src="./merch-card.ccd-slice.test.html.js"></script> | ||
<main> | ||
<sp-theme theme="spectrum" color="light" scale="medium"> | ||
<merch-card class="" tabindex="0" variant="ccd-slice" filters="" types=""> | ||
<sp-status-light size="l" variant="info" dir="ltr"></sp-status-light> | ||
<merch-icon | ||
slot="icons" | ||
src="https://www.adobe.com/content/dam/shared/images/product-icons/svg/photoshop.svg" | ||
alt="" | ||
href="" | ||
size="l" | ||
>undefined</merch-icon | ||
> | ||
<merch-icon | ||
slot="icons" | ||
src="https://www.adobe.com/content/dam/shared/images/product-icons/svg/lightroom.svg" | ||
alt="" | ||
href="" | ||
size="l" | ||
>undefined</merch-icon | ||
> | ||
<p slot="body-s"> | ||
<strong>Creative Cloud Photography plan.<br> | ||
Starting at US$19.99/mo | ||
</strong> | ||
</p> | ||
<div slot="footer"> | ||
<sp-button size="s" focusable>Buy now</sp-button> | ||
</div> | ||
<div slot="image"> | ||
<img src="./img/pixel.png" alt=""> | ||
</div> | ||
</merch-card | ||
> | ||
<merch-card size="wide" class="" tabindex="0" variant="ccd-slice" filters="" types=""> | ||
<sp-status-light size="l" variant="info" dir="ltr"></sp-status-light> | ||
<merch-icon | ||
slot="icons" | ||
src="https://www.adobe.com/content/dam/shared/images/product-icons/svg/creative-cloud.svg" | ||
alt="" | ||
href="" | ||
size="l" | ||
>undefined</merch-icon | ||
> | ||
<p slot="body-s"> | ||
<strong>Save over 30% on Creative Cloud All Apps. Register for MAX by August 31 and save US$200 on a full conference pass.</strong> | ||
<br><a href="https://www.adobe.com/creativecloud/all-apps.html" target="_blank">See terms</a> | ||
</p> | ||
<div slot="footer"> | ||
<sp-button size="s" focusable>Register now</sp-button> | ||
</div> | ||
<div slot="image"> | ||
<img src="./img/pixel.png" alt=""> | ||
</div> | ||
</merch-card> | ||
</sp-theme> | ||
</main> | ||
</body> | ||
</html> |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// @ts-nocheck | ||
import { runTests } from '@web/test-runner-mocha'; | ||
import { expect } from '@esm-bundle/chai'; | ||
|
||
import { mockLana } from './mocks/lana.js'; | ||
import { mockFetch } from './mocks/fetch.js'; | ||
|
||
import './spectrum.js'; | ||
import '../src/merch-offer.js'; | ||
import '../src/merch-offer-select.js'; | ||
import '../src/merch-quantity-select.js'; | ||
|
||
import { mockIms } from './mocks/ims.js'; | ||
import { withWcs } from './mocks/wcs.js'; | ||
import mas from './mas.js'; | ||
|
||
const skipTests = sessionStorage.getItem('skipTests'); | ||
|
||
runTests(async () => { | ||
mockIms(); | ||
mockLana(); | ||
await mockFetch(withWcs); | ||
await mas(); | ||
|
||
describe('merch-card web component', () => { | ||
it('should exist in the HTML document', async () => { | ||
expect(document.querySelector('merch-card[variant="ccd-slice"]')).to.exist; | ||
}); | ||
|
||
it('should have correct attributes for the ccd-slice wide card', async () => { | ||
const ccdSliceWideCard = document.querySelector('merch-card[variant="ccd-slice"][size="wide"]'); | ||
expect(ccdSliceWideCard.getAttribute('variant')).to.equal('ccd-slice'); | ||
expect(ccdSliceWideCard.getAttribute('size')).to.equal('wide'); | ||
}); | ||
}); | ||
|
||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.