generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 177
/
Copy pathccd-suggested.js
105 lines (88 loc) · 2.78 KB
/
ccd-suggested.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { html, css } from 'lit';
import { VariantLayout } from './variant-layout';
import { CSS } from './ccd-suggested.css.js';
const AEM_FRAGMENT_MAPPING = {
subtitle: { tag: 'h4', slot: 'detail-m' },
title: { tag: 'h3', slot: 'heading-xs' },
prices: { tag: 'p', slot: 'price' },
description: { tag: 'div', slot: 'body-xs' },
ctas: { slot: 'cta', size: 's', button: false },
};
export class CCDSuggested extends VariantLayout {
getGlobalCSS() {
return CSS;
}
/* c8 ignore next 3 */
get aemFragmentMapping() {
return AEM_FRAGMENT_MAPPING;
}
renderLayout () {
return html`
<div style="${this.stripStyle}" class="body">
<div class="header">
<slot name="icons"></slot>
<div class="headings">
<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']) {
background-color: var(
--spectrum-gray-50, #fff);
width: var(--merch-card-ccd-suggested-width);
min-height: var(--merch-card-ccd-suggested-height);
border-radius: 4px;
display: flex;
flex-flow: wrap;
}
:host([variant='ccd-suggested']) .body {
height: auto;
}
:host([variant='ccd-suggested']) .header {
display: flex;
flex-flow: wrap;
place-self: flex-start;
}
:host([variant='ccd-suggested']) .headings {
padding-inline-start: var(--consonant-merch-spacing-xxs);
}
:host([variant='ccd-suggested']) ::slotted([slot='icons']) {
place-self: flex-start;
}
:host([variant='ccd-suggested']) ::slotted([slot='heading-xs']) {
font-size: var(--merch-card-heading-xxs-font-size);
line-height: var(--merch-card-heading-xxs-line-height);
}
: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']) ::slotted([slot='price']) {
display: flex;
align-items: center;
color: var(--spectrum-gray-800, #F8F8F8);
}
:host([variant='ccd-suggested']) ::slotted([slot='cta']) {
display: flex;
align-items: center;
}
:host([variant='ccd-suggested']) .footer {
display: flex;
justify-content: space-between;
flex-grow: 0;
margin-top: auto;
align-items: center;
}
`;
};