generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 174
/
special-offer.js
67 lines (58 loc) · 1.78 KB
/
special-offer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { html, css } from 'lit';
import { VariantLayout } from './variant-layout';
import { CSS } from './special-offer.css.js';
const AEM_FRAGMENT_MAPPING = {
name: { tag: 'h4', slot: 'detail-m' },
title: { tag: 'h4', slot: 'detail-m' },
backgroundImage: { tag: 'div', slot: 'bg-image' },
prices: { tag: 'h3', slot: 'heading-xs' },
description: { tag: 'div', slot: 'body-xs' },
ctas: { slot: 'footer', size: 'l' },
};
export class SpecialOffer extends VariantLayout {
constructor(card) {
super(card);
}
getGlobalCSS() {
return CSS;
}
get headingSelector() {
return '[slot="detail-m"]';
}
get aemFragmentMapping() {
return AEM_FRAGMENT_MAPPING;
}
renderLayout() {
return html`${this.cardImage}
<div class="body">
<slot name="detail-m"></slot>
<slot name="heading-xs"></slot>
<slot name="body-xs"></slot>
</div>
${this.evergreen
? html`
<div
class="detail-bg-container"
style="background: ${this.card['detailBg']}"
>
<slot name="detail-bg"></slot>
</div>
`
: html`
<hr />
${this.secureLabelFooter}
`}
<slot></slot>`;
}
static variantStyle = css`
:host([variant='special-offers']) {
min-height: 439px;
}
:host([variant='special-offers']) {
width: var(--consonant-merch-card-special-offers-width);
}
:host([variant='special-offers'].center) {
text-align: center;
}
`;
}