-
Notifications
You must be signed in to change notification settings - Fork 156
/
feature-section.ts
101 lines (94 loc) · 3.59 KB
/
feature-section.ts
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
/**
* @license
*
* Copyright IBM Corp. 2020, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import { css, html } from 'lit';
import { property } from 'lit/decorators.js';
import settings from '../../internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings';
import C4DFeatureCard from '../feature-card/feature-card';
import '../image/image';
import styles from './feature-section.scss';
import StableSelectorMixin from '../../globals/mixins/stable-selector';
import { MEDIA_ALIGNMENT } from './defs';
import { carbonElement as customElement } from '../../internal/vendor/@carbon/web-components/globals/decorators/carbon-element';
const { prefix, stablePrefix: c4dPrefix } = settings;
/**
* Feature Section.
*
* @element c4d-feature-section
*/
@customElement(`${c4dPrefix}-feature-section`)
class C4DFeatureSection extends StableSelectorMixin(C4DFeatureCard) {
/**
* Media Alignment (right (default) | left)
*/
@property({ attribute: 'media-alignment', reflect: true })
mediaAlignment = MEDIA_ALIGNMENT.RIGHT;
render() {
return html`
${this.mediaAlignment === MEDIA_ALIGNMENT.LEFT
? html`
<div class="${prefix}--grid ${prefix}--feature-section">
<div class="${prefix}--row ${prefix}--feature-section__container">
<div
class="${prefix}--col-sm-4 ${prefix}--col-md-8 ${prefix}--col-lg-8 ${prefix}--feature-section__image">
<slot name="image"></slot>
</div>
<div
class="${prefix}--col-sm-4 ${prefix}--col-md-8 ${prefix}--col-lg-8 ${prefix}--feature-section__body">
<div class="${prefix}--grid">
<div class="${prefix}--row">
<div
class="${prefix}--col-sm-4 ${prefix}--col-md-6 ${prefix}--col-lg-12">
<slot name="eyebrow"></slot>
<slot name="heading"></slot>
<slot name="copy"></slot>
</div>
</div>
</div>
<slot name="footer"></slot>
</div>
</div>
</div>
`
: html`
<div class="${prefix}--grid ${prefix}--feature-section">
<div class="${prefix}--row ${prefix}--feature-section__container">
<div
class="${prefix}--col-sm-4 ${prefix}--col-md-8 ${prefix}--col-lg-8 ${prefix}--feature-section__body">
<div class="${prefix}--grid">
<div class="${prefix}--row">
<div
class="${prefix}--col-sm-4 ${prefix}--col-md-6 ${prefix}--col-lg-12">
<slot name="eyebrow"></slot>
<slot name="heading"></slot>
<slot name="copy"></slot>
</div>
</div>
</div>
</div>
<div
class="${prefix}--col-sm-4 ${prefix}--col-md-8 ${prefix}--col-lg-8 ${prefix}--feature-section__image">
<slot name="image"></slot>
<slot name="footer"></slot>
</div>
</div>
</div>
`}
`;
}
static get stableSelector() {
return `${c4dPrefix}--feature-section`;
}
static get styles() {
return css`
${super.styles}${styles}
`;
}
}
/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */
export default C4DFeatureSection;