@salesforcedevs/dw-components 1.15.0 → 1.15.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dw-components",
3
- "version": "1.15.0",
3
+ "version": "1.15.2",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -26,5 +26,5 @@
26
26
  "@types/setimmediate": "1.0.4",
27
27
  "setimmediate": "1.0.5"
28
28
  },
29
- "gitHead": "f2ca29c18bf3158e8edc88a21402617e528f2243"
29
+ "gitHead": "b8602f13fe7f2d709dd2843eb07121fc05844906"
30
30
  }
@@ -15,7 +15,10 @@
15
15
  authors={firstPost.authors}
16
16
  ></dx-card-blog-post>
17
17
  <dx-grid columns="one">
18
- <template for:each={secondAndThird} for:item="post">
18
+ <template
19
+ for:each={secondThirdAndFourth}
20
+ for:item="post"
21
+ >
19
22
  <dx-card-blog-post
20
23
  layout="horizontal"
21
24
  datetime={post.datetime}
@@ -30,26 +33,6 @@
30
33
  </dx-grid>
31
34
  </dx-grid>
32
35
  </div>
33
- <dx-grid columns="four">
34
- <template for:each={restOfBlogPosts} for:item="post">
35
- <dx-card-blog-post
36
- label="BLOG POST"
37
- body={post.body}
38
- datetime={post.datetime}
39
- href={post.href}
40
- img-alt={post.imgAlt}
41
- img-src={post.imgSrc}
42
- key={post.id}
43
- header={post.title}
44
- authors={post.authors}
45
- ></dx-card-blog-post>
46
- <dx-hr
47
- spacing="2xs"
48
- class="mobile-divider_posts"
49
- key={post.id}
50
- ></dx-hr>
51
- </template>
52
- </dx-grid>
53
36
  </div>
54
37
 
55
38
  <div class="hide-on-desktop">
@@ -17,7 +17,7 @@ type BlogPost = {
17
17
  };
18
18
 
19
19
  export default class CardBlogPostProvider extends LightningElement {
20
- @api count: string = "7";
20
+ @api count: string = "4";
21
21
  @track _sortedPosts: BlogPost[] = [];
22
22
 
23
23
  private _featuredPost: BlogPost | undefined;
@@ -28,7 +28,7 @@ export default class CardBlogPostProvider extends LightningElement {
28
28
  if (this._featuredPost) {
29
29
  this._sortedPosts = [
30
30
  this._featuredPost,
31
- ...this.filterOutFeaturedPost(posts)
31
+ ...this.filterOutFeaturedPost(posts, this._featuredPost)
32
32
  ];
33
33
  } else {
34
34
  this._sortedPosts = posts;
@@ -43,7 +43,7 @@ export default class CardBlogPostProvider extends LightningElement {
43
43
  this._featuredPost = featuredPost;
44
44
  this._sortedPosts = [
45
45
  featuredPost,
46
- ...this.filterOutFeaturedPost(this._posts)
46
+ ...this.filterOutFeaturedPost(this._posts, featuredPost)
47
47
  ];
48
48
  }
49
49
 
@@ -56,19 +56,15 @@ export default class CardBlogPostProvider extends LightningElement {
56
56
  return this._sortedPosts[0];
57
57
  }
58
58
 
59
- get secondAndThird() {
60
- return this._sortedPosts.slice(1, 3);
59
+ get secondThirdAndFourth() {
60
+ return this._sortedPosts.slice(1, 4);
61
61
  }
62
62
 
63
- get restOfBlogPosts() {
64
- return this._sortedPosts.slice(3);
65
- }
66
-
67
- private filterOutFeaturedPost(posts: BlogPost[]) {
63
+ private filterOutFeaturedPost(posts: BlogPost[], featuredPost: BlogPost) {
68
64
  // the featured post + the rest must equal count
69
65
  const countMinusOne = parseInt(this.count, 10) - 1;
70
66
  return posts
71
- .filter((post) => post.id !== this._featuredPost.id)
67
+ .filter((post) => post.id !== featuredPost.id)
72
68
  .slice(0, countMinusOne);
73
69
  }
74
70