@salesforcedevs/dw-components 1.1.2-alpha.5 → 1.2.4

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/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2020, Salesforce.com, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/lwc.config.json CHANGED
@@ -5,7 +5,6 @@
5
5
  ],
6
6
  "expose": [
7
7
  "dw/blogsGrid",
8
- "dw/browseTrials",
9
8
  "dw/cardBlogPostProvider",
10
9
  "dw/cardPodcastEpisodeProvider",
11
10
  "dw/codeSamplesGrid",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dw-components",
3
- "version": "1.1.2-alpha.5",
3
+ "version": "1.2.4",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -21,5 +21,6 @@
21
21
  "@types/lodash.clonedeep": "^4.5.7",
22
22
  "@types/lodash.orderby": "^4.6.7",
23
23
  "@types/lodash.uniqby": "^4.7.7"
24
- }
24
+ },
25
+ "gitHead": "66a0421aca28936a5556a9311aa14b8f175fb02c"
25
26
  }
@@ -83,11 +83,6 @@ dx-section:first-of-type {
83
83
  margin: 50px auto;
84
84
  }
85
85
 
86
- dx-type-badge.platform {
87
- --dx-c-type-badge-color: var(--dx-g-green-vibrant-40);
88
- --dx-c-type-badge-background: var(--dx-g-green-vibrant-90);
89
- }
90
-
91
86
  @media screen and (max-width: 1024px) {
92
87
  .code-samples-feature {
93
88
  --dx-c-feature-description-font-size: 14px;
@@ -102,10 +102,10 @@
102
102
  >
103
103
  <div class="badge-link-container">
104
104
  <div class="badge-container">
105
- <dx-type-badge
105
+ <dx-metadata-badge
106
106
  value={item.product}
107
- class={item.product}
108
- ></dx-type-badge>
107
+ size="small"
108
+ ></dx-metadata-badge>
109
109
  </div>
110
110
  <div class="external-link-container">
111
111
  <dx-button
@@ -123,7 +123,6 @@ export default class CodeSamplesGrid extends LightningElement {
123
123
 
124
124
  @api
125
125
  set samples(value: string) {
126
- console.log(value);
127
126
  const jsonSamples = toJson(value) || [];
128
127
  this._samplesList = jsonSamples.map((sample, i) => ({
129
128
  id: i,
@@ -363,7 +363,11 @@ export default class ContentArchive extends LightningElement {
363
363
  this.categoryList = categories;
364
364
  this.filtersLoading = false;
365
365
 
366
- requestAnimationFrame(() => this.updateAllFiltersFromUrl());
366
+ // note... this is super hacky... but necessary in order to both
367
+ // 1. actually filter the content
368
+ // 2. update the filter checkboxes to show that we filtered the content
369
+ this.updateAllFiltersFromUrl();
370
+ requestAnimationFrame(() => this.updateCheckedStatus());
367
371
  }
368
372
  }
369
373
 
@@ -465,8 +469,9 @@ export default class ContentArchive extends LightningElement {
465
469
  this.mobileMatchMedia.addEventListener("change", this.onMobileChange);
466
470
 
467
471
  if (this.posts.length === 0) {
468
- this.fetchArchiveFilterList();
469
- this.fetchPostsByCardType();
472
+ this.fetchArchiveFilterList().then(() => {
473
+ this.fetchPostsByCardType();
474
+ });
470
475
  }
471
476
  }
472
477
 
@@ -60,7 +60,7 @@ function normalizePosts(posts: Array<ArchivePost>, contentType: string) {
60
60
  id: post.id,
61
61
  title: post.title.rendered,
62
62
  date: post.date,
63
- contentType: post.sitename,
63
+ contentType: post.sitename.toLowerCase(),
64
64
  href: post.link,
65
65
  ...(contentType === "expanded" && {
66
66
  excerpt: post.excerpt,
@@ -21,7 +21,7 @@ export default class PodcastSubscription extends LightningElement {
21
21
 
22
22
  secondaryLinks = [
23
23
  {
24
- href: "https://app.stitcher.com/browse/feed/470480/details",
24
+ href: "https://www.stitcher.com/show/salesforce-developer-podcast",
25
25
  text: "Stitcher"
26
26
  },
27
27
  {
@@ -1,54 +0,0 @@
1
- @import "dxHelpers/reset";
2
- @import "dxHelpers/text";
3
-
4
- :host {
5
- --dw-browse-trials-padding-top: 0;
6
- --dw-browse-trials-padding-bottom: 0;
7
- }
8
-
9
- .title {
10
- color: var(--dx-g-blue-vibrant-20);
11
- font-family: var(--dx-g-font-display);
12
- font-weight: var(--dx-g-font-weight-demi);
13
- font-size: 32px;
14
- letter-spacing: -0.4px;
15
- line-height: 40px;
16
- margin-bottom: var(--dx-g-spacing-md);
17
- }
18
-
19
- .panel-list-container {
20
- padding: var(--dw-browse-trials-padding-top)
21
- var(--dx-g-page-padding-horizontal)
22
- var(--dw-browse-trials-padding-bottom)
23
- var(--dx-g-page-padding-horizontal);
24
- }
25
-
26
- dx-tab-panel-list {
27
- --dx-c-tab-panel-list-horizontal-padding: 0;
28
- }
29
-
30
- .category-text-container {
31
- width: 100%;
32
- }
33
-
34
- .category-subtitle {
35
- color: var(--dx-g-font-sans);
36
- margin-top: var(--dx-g-spacing-smd);
37
- max-width: 560px;
38
- }
39
-
40
- .button-toggle-container {
41
- display: flex;
42
- gap: var(--dx-g-spacing-md);
43
- margin-top: var(--dx-g-spacing-3xl);
44
- }
45
-
46
- .category-container {
47
- display: flex;
48
- flex-wrap: wrap;
49
- gap: 40px;
50
- }
51
-
52
- .category-container {
53
- margin-top: var(--dx-g-spacing-4xl);
54
- }
@@ -1,81 +0,0 @@
1
- <template>
2
- <div class="panel-list-container">
3
- <h2 class="title">{title}</h2>
4
- <dx-tab-panel-list tabs={tabLabels} onchange={handleTabChange}>
5
- <template for:each={trials} for:item="trial">
6
- <dx-tab-panel key={trial.label}>
7
- <div
8
- key={trial.label}
9
- class="button-toggle-container"
10
- if:false={trial.hideFilters}
11
- >
12
- <template
13
- for:each={buttonToggleStates}
14
- for:item="buttonToggleState"
15
- >
16
- <dx-button-toggle
17
- label={buttonToggleState.label}
18
- key={buttonToggleState.label}
19
- value={buttonToggleState.value}
20
- ontoggle={handleFilters}
21
- ></dx-button-toggle>
22
- </template>
23
- </div>
24
- <template for:each={filteredCategories} for:item="category">
25
- <div key={category.title} class="category-container">
26
- <div
27
- if:true={category.title}
28
- class="category-text-container"
29
- >
30
- <h2 class="dx-text-heading-4 category-title">
31
- {category.title}
32
- </h2>
33
- <p
34
- if:true={category.subtitle}
35
- class="category-subtitle"
36
- >
37
- {category.subtitle}
38
- </p>
39
- </div>
40
- <template for:each={category.cards} for:item="card">
41
- <template if:true={card.hasModal}>
42
- <dx-card-trial
43
- key={card.title}
44
- badge-symbol={card.badgeSymbol}
45
- body={card.body}
46
- details={card.details}
47
- modal-title={card.modalTitle}
48
- modal-details={card.modalDetails}
49
- href={card.href}
50
- label={card.label}
51
- terms={card.terms}
52
- title={card.title}
53
- button-one-cta={card.buttonOneCta}
54
- button-one-href={card.buttonOneHref}
55
- button-one-icon={card.buttonOneIcon}
56
- button-two-cta={card.buttonTwoCta}
57
- hide-card-details="true"
58
- ></dx-card-trial>
59
- </template>
60
- <template if:false={card.hasModal}>
61
- <dx-card-trial
62
- key={card.title}
63
- badge-symbol={card.badgeSymbol}
64
- body={card.body}
65
- href={card.href}
66
- label={card.label}
67
- terms={card.terms}
68
- title={card.title}
69
- button-one-cta={card.buttonOneCta}
70
- button-one-href={card.buttonOneHref}
71
- button-one-icon={card.buttonOneIcon}
72
- ></dx-card-trial>
73
- </template>
74
- </template>
75
- </div>
76
- </template>
77
- </dx-tab-panel>
78
- </template>
79
- </dx-tab-panel-list>
80
- </div>
81
- </template>
@@ -1,104 +0,0 @@
1
- import { LightningElement, api, track } from "lwc";
2
- import { toJson } from "dxUtils/normalizers";
3
-
4
- export default class BrowseTrials extends LightningElement {
5
- @api title = "Browse Trials";
6
-
7
- @api
8
- get trials() {
9
- return this._trials;
10
- }
11
- set trials(
12
- value: [{ label: string; hideFilters: boolean; buttonLabels: string[] }]
13
- ) {
14
- this._trials = toJson(value);
15
- this.tabLabels = this._trials.map((trial) => ({ label: trial.label }));
16
- this.buttonLabels = this._trials.map((trial) =>
17
- !trial.hideFilters ? trial.buttonLabels : []
18
- );
19
- this._filteredTitles = this._trials.map(() => []);
20
- this._filteredCategories = this._trials.map(
21
- (trial) => trial.categories
22
- );
23
- }
24
-
25
- get buttonToggleStates() {
26
- return this.buttonLabels[this.activeTabIndex].map((label) => ({
27
- label,
28
- value: this.activeFilteredTitles.includes(label)
29
- }));
30
- }
31
-
32
- get activeFilteredTitles() {
33
- return this._filteredTitles[this.activeTabIndex];
34
- }
35
- set activeFilteredTitles(value: string[]) {
36
- this._filteredTitles[this.activeTabIndex] = value;
37
- }
38
-
39
- get activeCategories() {
40
- return this._trials[this.activeTabIndex].categories;
41
- }
42
-
43
- get filteredCategories() {
44
- return this._filteredCategories[this.activeTabIndex];
45
- }
46
- set filteredCategories(value: any) {
47
- this._filteredCategories[this.activeTabIndex] = value;
48
- }
49
-
50
- @track
51
- private _filteredCategories!: Array<any>;
52
-
53
- private activeTabIndex = 0;
54
- private buttonLabels!: string[][];
55
- private _filteredTitles!: string[][];
56
- private tabLabels!: Array<{ label: string }>;
57
- private _trials!: [
58
- {
59
- label: string;
60
- hideFilters: boolean;
61
- buttonLabels: string[];
62
- categories: Array<{ title: string }>;
63
- }
64
- ];
65
-
66
- handleTabChange(e: CustomEvent) {
67
- this.activeTabIndex = e.detail;
68
- }
69
-
70
- filterCategories() {
71
- this.filteredCategories = this.activeCategories.filter((category) =>
72
- this.activeFilteredTitles.includes(category.title)
73
- );
74
- }
75
-
76
- addLabelToFilter(label: string) {
77
- this.activeFilteredTitles.push(label);
78
- this.filterCategories();
79
- }
80
-
81
- removeLabelFromFilter(label: string) {
82
- this.activeFilteredTitles = this.activeFilteredTitles.filter(
83
- (filterTitle) => filterTitle !== label
84
- );
85
- this.filterCategories();
86
- }
87
-
88
- resetFilters() {
89
- this.activeFilteredTitles = [];
90
- this.filteredCategories = this.activeCategories;
91
- }
92
-
93
- handleFilters(e: CustomEvent) {
94
- const { label, value } = e.detail;
95
-
96
- if (value) {
97
- this.addLabelToFilter(label);
98
- } else if (this.activeFilteredTitles.length !== 1) {
99
- this.removeLabelFromFilter(label);
100
- } else {
101
- this.resetFilters();
102
- }
103
- }
104
- }