@salesforcedevs/dx-components 1.3.66-alpha-031 → 1.3.66-alpha-032
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
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { LightningElement, api, track } from "lwc";
|
|
|
2
2
|
import type * as CoveoSDK from "coveo-search-ui";
|
|
3
3
|
import { track as trackGTM } from "dxUtils/analytics";
|
|
4
4
|
import { CONTENT_TYPE_LABELS } from "dxConstants/contentTypes";
|
|
5
|
-
import { getContentTypeColorVariables } from "
|
|
5
|
+
import { getContentTypeColorVariables } from "dxUtils/contentTypes";
|
|
6
6
|
|
|
7
7
|
interface CoveoSearch {
|
|
8
8
|
state: typeof CoveoSDK.state;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CONTENT_TYPES } from "dxConstants/contentTypes";
|
|
2
|
+
import { BRANDS } from "dxConstants/brands";
|
|
3
|
+
import { ContentType } from "typings/custom";
|
|
4
|
+
import { buildStyleColorVariables } from "dxUtils/css";
|
|
5
|
+
|
|
6
|
+
export const isBrand = (id: string): boolean => {
|
|
7
|
+
return BRANDS.includes(id as ContentType);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const isContentType = (id: string): boolean => {
|
|
11
|
+
return CONTENT_TYPES.includes(id as ContentType);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const getContentTypeColorScope = (id: string): string | null => {
|
|
15
|
+
if (isContentType(id)) {
|
|
16
|
+
return "content-type";
|
|
17
|
+
}
|
|
18
|
+
if (isBrand(id)) {
|
|
19
|
+
return "brand";
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const getContentTypeColorVariables = (id: string): string => {
|
|
25
|
+
const scope = getContentTypeColorScope(id);
|
|
26
|
+
return buildStyleColorVariables({
|
|
27
|
+
background: `--dx-g-${scope}-${id}-color-background`,
|
|
28
|
+
color: `--dx-g-${scope}-${id}-color`
|
|
29
|
+
});
|
|
30
|
+
}
|