@salesforcedevs/dx-components 1.0.0 → 1.2.2-avatar-button-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lwc.config.json +5 -1
- package/package.json +3 -2
- package/src/assets/svg/login-widget-bg.png +0 -0
- package/src/modules/dx/avatarButton/avatarButton.css +129 -0
- package/src/modules/dx/avatarButton/avatarButton.html +155 -0
- package/src/modules/dx/avatarButton/avatarButton.ts +354 -0
- package/src/modules/dx/cardEvent/cardEvent.html +1 -2
- package/src/modules/dx/cardEvent/cardEvent.ts +1 -1
- package/src/modules/dx/cardExpanded/cardExpanded.html +1 -6
- package/src/modules/dx/cardExpanded/cardExpanded.ts +2 -2
- package/src/modules/dx/cardMinimal/cardMinimal.html +1 -6
- package/src/modules/dx/header/header.html +3 -0
- package/src/modules/dx/header/header.ts +4 -0
- package/src/modules/dx/logo/logo.ts +1 -1
- package/src/modules/dx/metadataBadge/metadataBadge.css +49 -0
- package/src/modules/dx/metadataBadge/metadataBadge.html +5 -0
- package/src/modules/dx/metadataBadge/metadataBadge.ts +24 -0
- package/src/modules/dx/treeItem/treeItem.html +1 -0
- package/src/modules/dx/treeTile/treeTile.css +17 -17
- package/src/modules/dx/treeTile/treeTile.html +5 -4
- package/src/modules/dx/treeTile/treeTile.ts +17 -3
- package/src/modules/dx/typeBadge/typeBadge.css +15 -56
- package/src/modules/dx/typeBadge/typeBadge.html +6 -0
- package/src/modules/dx/typeBadge/typeBadge.ts +142 -46
- package/src/modules/dxBaseElements/archiveCard/archiveCard.ts +2 -6
- package/src/modules/dxConstants/brands/brands.ts +14 -0
- package/src/modules/dxConstants/colors/colors.ts +14 -0
- package/src/modules/dxConstants/contentTypes/contentTypes.ts +10 -0
- package/src/modules/dxHelpers/commonHeader/commonHeader.css +4 -2
- package/src/modules/dxUtils/css/css.ts +10 -0
- package/yarn-error.log +19802 -0
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.css +0 -12
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.html +0 -11
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.ts +0 -18
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class={containerClass}>
|
|
3
|
-
<dx-type-badge
|
|
4
|
-
color={badgeColor}
|
|
5
|
-
type="content-type"
|
|
6
|
-
value={contentType}
|
|
7
|
-
size={badgeSize}
|
|
8
|
-
></dx-type-badge>
|
|
3
|
+
<dx-type-badge variant={contentType} size={badgeSize}></dx-type-badge>
|
|
9
4
|
<dx-card-title
|
|
10
5
|
if:true={title}
|
|
11
6
|
href={href}
|
|
@@ -10,8 +10,8 @@ export default class ExpandedCard extends ArchiveCard {
|
|
|
10
10
|
@api authorImgSrc?: string | null = null;
|
|
11
11
|
@api length?: string;
|
|
12
12
|
|
|
13
|
-
private get isBlog() {
|
|
14
|
-
return this.contentType === "
|
|
13
|
+
private get isBlog(): boolean {
|
|
14
|
+
return this.contentType === "blog";
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
private get hasAuthor(): boolean {
|
|
@@ -3,11 +3,6 @@
|
|
|
3
3
|
<a class="dx-text-truncate" href={href} target={target}>
|
|
4
4
|
<h4>{title}</h4>
|
|
5
5
|
</a>
|
|
6
|
-
<dx-type-badge
|
|
7
|
-
color={badgeColor}
|
|
8
|
-
size={badgeSize}
|
|
9
|
-
type="content-type"
|
|
10
|
-
value={contentType}
|
|
11
|
-
></dx-type-badge>
|
|
6
|
+
<dx-type-badge variant={contentType} size={badgeSize}></dx-type-badge>
|
|
12
7
|
</div>
|
|
13
8
|
</template>
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
onstatechange={handleStateChange}
|
|
20
20
|
></dx-header-search>
|
|
21
21
|
</div>
|
|
22
|
+
<div if:true={showTbidLogin} class="header-tbid-login">
|
|
23
|
+
<dx-avatar-button></dx-avatar-button>
|
|
24
|
+
</div>
|
|
22
25
|
<div if:true={showSignup} class="header-login-signup">
|
|
23
26
|
<dx-button
|
|
24
27
|
aria-label="Sign Up For Salesforce Developer Edition"
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { HeaderBase } from "dxBaseElements/headerBase";
|
|
2
2
|
|
|
3
3
|
export default class Header extends HeaderBase {
|
|
4
|
+
private get showTbidLogin(): boolean {
|
|
5
|
+
return this.showSignup;
|
|
6
|
+
}
|
|
7
|
+
|
|
4
8
|
private get showSignup(): boolean {
|
|
5
9
|
return this.signupLink
|
|
6
10
|
? (this.mobile && !this.isSearchOpen) || !this.mobile
|
|
@@ -3,6 +3,6 @@ import { LightningElement, api } from "lwc";
|
|
|
3
3
|
export default class Logo extends LightningElement {
|
|
4
4
|
@api href: string = "/";
|
|
5
5
|
@api imgSrc: string = "/assets/svg/salesforce-cloud.svg";
|
|
6
|
-
@api imgAlt: string = "Salesforce
|
|
6
|
+
@api imgAlt: string = "Salesforce logo";
|
|
7
7
|
@api label!: string;
|
|
8
8
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
|
|
3
|
+
.badge {
|
|
4
|
+
--background: var(--dx-g-cloud-blue-natural-90);
|
|
5
|
+
--border-radius: var(--dx-g-spacing-xs);
|
|
6
|
+
--color: var(--dx-g-blue-vibrant-20);
|
|
7
|
+
--height: var(--dx-g-spacing-lg);
|
|
8
|
+
--horizontal-spacing: var(--dx-g-spacing-sm);
|
|
9
|
+
|
|
10
|
+
color: var(--dx-c-metadata-badge-color, var(--color));
|
|
11
|
+
background: var(--dx-c-metadata-badge-background, var(--background));
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
height: var(--height);
|
|
16
|
+
width: min-content;
|
|
17
|
+
padding: 0 var(--horizontal-spacing);
|
|
18
|
+
border-radius: var(--border-radius);
|
|
19
|
+
font-family: var(--dx-g-font-display);
|
|
20
|
+
font-size: 10px;
|
|
21
|
+
text-align: center;
|
|
22
|
+
letter-spacing: 0.6px;
|
|
23
|
+
text-transform: uppercase;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.badge.size-small {
|
|
28
|
+
--height: var(--dx-g-spacing-md);
|
|
29
|
+
--horizontal-spacing: var(--dx-g-spacing-xs);
|
|
30
|
+
|
|
31
|
+
font-size: 8px;
|
|
32
|
+
letter-spacing: 0.5px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.badge span {
|
|
36
|
+
transform: translateY(2px);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.badge.size-small span {
|
|
40
|
+
transform: translateY(1px);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media screen and (max-width: 768px) {
|
|
44
|
+
.badge:not(.size-small) {
|
|
45
|
+
height: var(--dx-g-spacing-lg);
|
|
46
|
+
padding: 0 var(--dx-g-spacing-sm);
|
|
47
|
+
font-size: var(--dx-g-text-2xs);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { Color, TypeBadgeSize } from "typings/custom";
|
|
4
|
+
import { colorToDxColors, buildStyleColorVariables } from "dxUtils/css";
|
|
5
|
+
|
|
6
|
+
export default class MetadataBadge extends LightningElement {
|
|
7
|
+
@api size: TypeBadgeSize = "default";
|
|
8
|
+
@api color?: Color;
|
|
9
|
+
@api value!: string;
|
|
10
|
+
|
|
11
|
+
private get className(): string {
|
|
12
|
+
return cx("badge", `size-${this.size}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
private get style(): string {
|
|
16
|
+
if (this.color) {
|
|
17
|
+
const variables = colorToDxColors(this.color as Color);
|
|
18
|
+
if (variables) {
|
|
19
|
+
return buildStyleColorVariables(variables);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -145,33 +145,33 @@
|
|
|
145
145
|
--indentation: calc(20 * var(--base-indentation));
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
dx-
|
|
149
|
-
--dx-c-
|
|
148
|
+
dx-metadata-badge {
|
|
149
|
+
--dx-c-metadata-badge-text-width: 21px;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
dx-
|
|
153
|
-
--dx-c-
|
|
154
|
-
--dx-c-
|
|
152
|
+
dx-metadata-badge.get {
|
|
153
|
+
--dx-c-metadata-badge-color: var(--dx-g-blue-vibrant-50);
|
|
154
|
+
--dx-c-metadata-badge-background: var(--dx-g-blue-vibrant-90);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
dx-
|
|
158
|
-
--dx-c-
|
|
159
|
-
--dx-c-
|
|
157
|
+
dx-metadata-badge.put {
|
|
158
|
+
--dx-c-metadata-badge-color: var(--dx-g-yellow-vibrant-40);
|
|
159
|
+
--dx-c-metadata-badge-background: var(--dx-g-yellow-vibrant-90);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
dx-
|
|
163
|
-
--dx-c-
|
|
164
|
-
--dx-c-
|
|
162
|
+
dx-metadata-badge.post {
|
|
163
|
+
--dx-c-metadata-badge-color: var(--dx-g-green-vibrant-40);
|
|
164
|
+
--dx-c-metadata-badge-background: var(--dx-g-green-vibrant-90);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
dx-
|
|
168
|
-
--dx-c-
|
|
169
|
-
--dx-c-
|
|
167
|
+
dx-metadata-badge.patch {
|
|
168
|
+
--dx-c-metadata-badge-color: var(--dx-g-teal-vibrant-40);
|
|
169
|
+
--dx-c-metadata-badge-background: var(--dx-g-teal-vibrant-90);
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
dx-
|
|
173
|
-
--dx-c-
|
|
174
|
-
--dx-c-
|
|
172
|
+
dx-metadata-badge.delete {
|
|
173
|
+
--dx-c-metadata-badge-color: var(--dx-g-red-vibrant-40);
|
|
174
|
+
--dx-c-metadata-badge-background: var(--dx-g-hot-orange-vibrant-90);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
a {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<a href={href} class={tileClass}>
|
|
2
|
+
<a href={href} class={tileClass} target={target}>
|
|
3
3
|
<div class="flex indentation" aria-level={tileAriaLevel}>
|
|
4
4
|
<span
|
|
5
5
|
class="tile-label sidebar-item-truncate-text"
|
|
@@ -16,12 +16,13 @@
|
|
|
16
16
|
onclick={onClickIcon}
|
|
17
17
|
></dx-icon>
|
|
18
18
|
</div>
|
|
19
|
-
<dx-
|
|
19
|
+
<dx-metadata-badge
|
|
20
20
|
if:true={showMethod}
|
|
21
|
-
class=
|
|
21
|
+
class="flex tile-icon"
|
|
22
22
|
size="small"
|
|
23
23
|
value={methodText}
|
|
24
|
-
|
|
24
|
+
color={metadataBadgeColor}
|
|
25
|
+
></dx-metadata-badge>
|
|
25
26
|
</div>
|
|
26
27
|
</a>
|
|
27
28
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import { InternalTreeNode } from "typings/custom";
|
|
3
|
+
import { Color, InternalTreeNode } from "typings/custom";
|
|
4
4
|
|
|
5
5
|
const methodTextMap: {
|
|
6
6
|
[key: string]: string;
|
|
@@ -12,6 +12,16 @@ const methodTextMap: {
|
|
|
12
12
|
delete: "DELE"
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
const metadataBadgeColorMap: {
|
|
16
|
+
[key: string]: Color;
|
|
17
|
+
} = {
|
|
18
|
+
get: "blue",
|
|
19
|
+
put: "yellow",
|
|
20
|
+
post: "green",
|
|
21
|
+
patch: "teal",
|
|
22
|
+
delete: "red"
|
|
23
|
+
};
|
|
24
|
+
|
|
15
25
|
export default class TreeTile extends LightningElement {
|
|
16
26
|
@api isRoot = false;
|
|
17
27
|
@api treeNode!: InternalTreeNode;
|
|
@@ -20,6 +30,7 @@ export default class TreeTile extends LightningElement {
|
|
|
20
30
|
@api isSelected = false;
|
|
21
31
|
@api href!: string;
|
|
22
32
|
@api showArrow = false;
|
|
33
|
+
@api target!: string;
|
|
23
34
|
|
|
24
35
|
get tileAriaLevel() {
|
|
25
36
|
return this.treeNode.level + 2;
|
|
@@ -29,8 +40,11 @@ export default class TreeTile extends LightningElement {
|
|
|
29
40
|
return this.isRoot ? "small" : "xsmall";
|
|
30
41
|
}
|
|
31
42
|
|
|
32
|
-
private get
|
|
33
|
-
|
|
43
|
+
private get metadataBadgeColor(): string | undefined {
|
|
44
|
+
if (this.treeNode.method) {
|
|
45
|
+
return metadataBadgeColorMap[this.treeNode.method];
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
34
48
|
}
|
|
35
49
|
|
|
36
50
|
private get showMethod() {
|
|
@@ -1,33 +1,6 @@
|
|
|
1
1
|
@import "dxHelpers/reset";
|
|
2
2
|
|
|
3
|
-
.
|
|
4
|
-
align-items: center;
|
|
5
|
-
background: var(--dx-c-type-badge-background, var(--background));
|
|
6
|
-
border-radius: var(--dx-c-type-badge-border-radius, var(--border-radius));
|
|
7
|
-
color: var(--dx-c-type-badge-color, var(--color));
|
|
8
|
-
display: flex;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
height: var(--dx-c-type-badge-height, var(--height));
|
|
11
|
-
text-align: center;
|
|
12
|
-
white-space: nowrap;
|
|
13
|
-
width: min-content;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.typebadge.typebadge_metadata {
|
|
17
|
-
--background: var(--dx-g-cloud-blue-natural-90);
|
|
18
|
-
--border-radius: var(--dx-g-spacing-xs);
|
|
19
|
-
--color: var(--dx-g-blue-vibrant-20);
|
|
20
|
-
--height: var(--dx-g-spacing-md);
|
|
21
|
-
--horizontal-spacing: var(--dx-g-spacing-sm);
|
|
22
|
-
|
|
23
|
-
font-family: var(--dx-g-font-display);
|
|
24
|
-
font-size: 10px;
|
|
25
|
-
letter-spacing: 0.6px;
|
|
26
|
-
text-transform: var(--dx-c-type-badge-text-transform, uppercase);
|
|
27
|
-
padding: 0 var(--horizontal-spacing);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.typebadge.typebadge_content-type {
|
|
3
|
+
.badge {
|
|
31
4
|
--background: var(--sds-g-gray-3);
|
|
32
5
|
--border-radius: var(--dx-g-spacing-smd);
|
|
33
6
|
--color: var(--sds-g-gray-10);
|
|
@@ -35,40 +8,26 @@
|
|
|
35
8
|
--horizontal-spacing: var(--dx-g-spacing-smd);
|
|
36
9
|
--vertical-spacing: var(--dx-g-spacing-xs);
|
|
37
10
|
|
|
11
|
+
color: var(--dx-c-type-badge-color, var(--color));
|
|
12
|
+
background: var(--dx-c-type-badge-background, var(--background));
|
|
13
|
+
border-radius: var(--border-radius);
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
height: var(--height);
|
|
18
|
+
width: min-content;
|
|
19
|
+
text-align: center;
|
|
20
|
+
white-space: nowrap;
|
|
38
21
|
font-family: var(--dx-g-font-sans);
|
|
39
|
-
font-size:
|
|
22
|
+
font-size: 10px;
|
|
40
23
|
font-weight: var(--dx-g-font-bold);
|
|
41
24
|
padding: var(--vertical-spacing) var(--horizontal-spacing);
|
|
42
25
|
}
|
|
43
26
|
|
|
44
|
-
.
|
|
27
|
+
.badge.size-small {
|
|
45
28
|
--height: var(--dx-g-spacing-mlg);
|
|
46
|
-
--horizontal-spacing: var(--dx-g-spacing-sm);
|
|
47
|
-
|
|
48
|
-
font-size: 10px;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.typebadge.typebadge_metadata.size-small {
|
|
52
|
-
--height: var(--dx-g-spacing-md);
|
|
53
|
-
--horizontal-spacing: var(--dx-g-spacing-xs);
|
|
54
|
-
|
|
55
|
-
font-size: 8px;
|
|
56
|
-
letter-spacing: 0.5px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.typebadge.typebadge_metadata span {
|
|
60
|
-
transform: translateY(2px);
|
|
61
|
-
width: var(--dx-c-type-badge-text-width, unset);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.typebadge.typebadge_metadata.size-small span {
|
|
65
|
-
transform: translateY(1px);
|
|
66
29
|
}
|
|
67
30
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
height: var(--dx-g-spacing-lg);
|
|
71
|
-
padding: 0 var(--dx-g-spacing-sm);
|
|
72
|
-
font-size: var(--dx-g-text-2xs);
|
|
73
|
-
}
|
|
31
|
+
dx-icon {
|
|
32
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
74
33
|
}
|
|
@@ -1,65 +1,161 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
Brand,
|
|
5
5
|
Color,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
ContentType,
|
|
7
|
+
IconSprite,
|
|
8
|
+
IconSymbol,
|
|
9
|
+
TypeBadgeSize
|
|
9
10
|
} from "typings/custom";
|
|
10
|
-
import { colorToDxColors } from "dxUtils/css";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
import { colorToDxColors, buildStyleColorVariables } from "dxUtils/css";
|
|
12
|
+
import { BRANDS } from "dxConstants/brands";
|
|
13
|
+
import { CONTENT_TYPES } from "dxConstants/contentTypes";
|
|
14
|
+
|
|
15
|
+
const contentTypeLabels = {
|
|
16
|
+
documentation: "Documentation",
|
|
17
|
+
trailhead: "Trailhead",
|
|
18
|
+
blog: "Blog",
|
|
19
|
+
forum: "Forum",
|
|
20
|
+
api: "API",
|
|
21
|
+
event: "Event",
|
|
22
|
+
website: "Website",
|
|
23
|
+
podcast: "Podcast"
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type IconData = {
|
|
27
|
+
iconSymbol: IconSymbol;
|
|
28
|
+
iconSprite: IconSprite;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const contentTypeIcons: {
|
|
32
|
+
[K in ContentType]: IconData;
|
|
33
|
+
} = {
|
|
34
|
+
documentation: {
|
|
35
|
+
iconSprite: "utility",
|
|
36
|
+
iconSymbol: "knowledge_base"
|
|
37
|
+
},
|
|
38
|
+
trailhead: {
|
|
39
|
+
iconSprite: "salesforcebrand",
|
|
40
|
+
iconSymbol: "learning"
|
|
41
|
+
},
|
|
42
|
+
blog: {
|
|
43
|
+
iconSprite: "utility",
|
|
44
|
+
iconSymbol: "comments"
|
|
45
|
+
},
|
|
46
|
+
forum: {
|
|
47
|
+
iconSprite: "general",
|
|
48
|
+
iconSymbol: "question-circle"
|
|
49
|
+
},
|
|
50
|
+
api: {
|
|
51
|
+
iconSprite: "utility",
|
|
52
|
+
iconSymbol: "settings"
|
|
53
|
+
},
|
|
54
|
+
event: {
|
|
55
|
+
iconSprite: "utility",
|
|
56
|
+
iconSymbol: "event"
|
|
57
|
+
},
|
|
58
|
+
website: {
|
|
59
|
+
iconSprite: "utility",
|
|
60
|
+
iconSymbol: "home"
|
|
61
|
+
},
|
|
62
|
+
podcast: {
|
|
63
|
+
iconSprite: "utility",
|
|
64
|
+
iconSymbol: "unmuted"
|
|
65
|
+
}
|
|
66
|
+
};
|
|
27
67
|
|
|
28
68
|
export default class TypeBadge extends LightningElement {
|
|
29
69
|
@api size: TypeBadgeSize = "default";
|
|
30
|
-
@api
|
|
31
|
-
@api color?:
|
|
32
|
-
|
|
70
|
+
@api variant?: Brand | ContentType = "default";
|
|
71
|
+
@api color?: Color;
|
|
72
|
+
|
|
73
|
+
@api
|
|
74
|
+
get iconSymbol(): IconSymbol | undefined {
|
|
75
|
+
return this.variantIconData
|
|
76
|
+
? this.variantIconData.iconSymbol
|
|
77
|
+
: this._iconSymbol;
|
|
78
|
+
}
|
|
79
|
+
set iconSymbol(value: IconSymbol | undefined) {
|
|
80
|
+
if (value) {
|
|
81
|
+
this._iconSymbol = value;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@api
|
|
86
|
+
get iconSprite(): IconSprite | undefined {
|
|
87
|
+
return this.variantIconData
|
|
88
|
+
? this.variantIconData.iconSprite
|
|
89
|
+
: this._iconSprite;
|
|
90
|
+
}
|
|
91
|
+
set iconSprite(value: IconSprite | undefined) {
|
|
92
|
+
if (value) {
|
|
93
|
+
this._iconSprite = value;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@api
|
|
98
|
+
get value(): string {
|
|
99
|
+
return this._value || this.variantLabel || "";
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
set value(value) {
|
|
103
|
+
if (value) {
|
|
104
|
+
this._value = value;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private _value?: string;
|
|
109
|
+
private _iconSprite?: IconSprite;
|
|
110
|
+
private _iconSymbol?: IconSymbol;
|
|
111
|
+
|
|
112
|
+
private get variantIconData(): IconData | null {
|
|
113
|
+
if (this.variant && this.variant in contentTypeIcons) {
|
|
114
|
+
return contentTypeIcons[this.variant as ContentType];
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private get variantLabel(): string | null {
|
|
120
|
+
if (this.isContentType) {
|
|
121
|
+
return contentTypeLabels[this.variant as ContentType];
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private get variantColorScope(): string | null {
|
|
127
|
+
if (this.isContentType) {
|
|
128
|
+
return "content-type";
|
|
129
|
+
}
|
|
130
|
+
if (this.isBrand) {
|
|
131
|
+
return "brand";
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private get isContentType(): boolean {
|
|
137
|
+
return CONTENT_TYPES.includes(this.variant as ContentType);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
private get isBrand(): boolean {
|
|
141
|
+
return BRANDS.includes(this.variant as ContentType);
|
|
142
|
+
}
|
|
33
143
|
|
|
34
144
|
private get className(): string {
|
|
35
|
-
return cx(
|
|
36
|
-
"typebadge",
|
|
37
|
-
`size-${this.size}`,
|
|
38
|
-
(this.type && `typebadge_${this.type}`) || DEFAULT_TYPE
|
|
39
|
-
);
|
|
145
|
+
return cx("badge", `size-${this.size}`);
|
|
40
146
|
}
|
|
41
147
|
|
|
42
148
|
private get style(): string {
|
|
43
|
-
if (
|
|
44
|
-
return
|
|
45
|
-
background: `--dx-g
|
|
46
|
-
color: `--dx-g
|
|
149
|
+
if (this.variantColorScope) {
|
|
150
|
+
return buildStyleColorVariables({
|
|
151
|
+
background: `--dx-g-${this.variantColorScope}-${this.variant}-color-background`,
|
|
152
|
+
color: `--dx-g-${this.variantColorScope}-${this.variant}-color`
|
|
47
153
|
});
|
|
48
154
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return
|
|
155
|
+
if (this.color) {
|
|
156
|
+
const variables = colorToDxColors(this.color as Color);
|
|
157
|
+
return buildStyleColorVariables(variables);
|
|
52
158
|
}
|
|
53
159
|
return "";
|
|
54
160
|
}
|
|
55
|
-
|
|
56
|
-
private buildStyleString({
|
|
57
|
-
background,
|
|
58
|
-
color
|
|
59
|
-
}: {
|
|
60
|
-
background: string;
|
|
61
|
-
color: string;
|
|
62
|
-
}): string {
|
|
63
|
-
return `--color: var(${color}); --background: var(${background})`;
|
|
64
|
-
}
|
|
65
161
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
|
-
import { LinkTarget,
|
|
2
|
+
import { LinkTarget, ContentType } from "typings/custom";
|
|
3
3
|
|
|
4
4
|
const MOBILE_QUERY = "(max-width: 640px)";
|
|
5
5
|
|
|
6
6
|
export abstract class ArchiveCard extends LightningElement {
|
|
7
|
-
@api contentType
|
|
7
|
+
@api contentType!: ContentType;
|
|
8
8
|
@api href!: string;
|
|
9
9
|
@api title!: string;
|
|
10
10
|
@api target: LinkTarget = "_self";
|
|
@@ -12,10 +12,6 @@ export abstract class ArchiveCard extends LightningElement {
|
|
|
12
12
|
private matchMedia!: MediaQueryList;
|
|
13
13
|
protected mobile = false;
|
|
14
14
|
|
|
15
|
-
protected get badgeColor(): Color {
|
|
16
|
-
return this.contentType === "Blog" ? "teal" : "blue";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
15
|
connectedCallback(): void {
|
|
20
16
|
this.matchMedia = window.matchMedia(MOBILE_QUERY);
|
|
21
17
|
this.onMediaChange(this.matchMedia);
|