@salesforcedevs/dw-components 1.3.256 → 1.3.261

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
@@ -5,6 +5,7 @@
5
5
  ],
6
6
  "expose": [
7
7
  "dw/blogsGrid",
8
+ "dw/videoGrid",
8
9
  "dw/browseTrials",
9
10
  "dw/cardBlogPostProvider",
10
11
  "dw/cardPodcastEpisodeProvider",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dw-components",
3
- "version": "1.3.256",
3
+ "version": "1.3.261",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -24,5 +24,5 @@
24
24
  "@types/setimmediate": "^1.0.2",
25
25
  "setimmediate": "^1.0.5"
26
26
  },
27
- "gitHead": "c0afc0d0174da7941a7955691f2cc0c0efe69620"
27
+ "gitHead": "8f326de081fbbef38ac44074ed4f54190e6416c1"
28
28
  }
@@ -0,0 +1,12 @@
1
+ export type VideoCardsData = {
2
+ type: "twitter" | "linkedin";
3
+ title: string;
4
+ body: string;
5
+ hasSocial: boolean;
6
+ socialName: string;
7
+ socialJobTitle: string;
8
+ socialProfileImgSrc: "string";
9
+ isLinkedin: boolean | undefined;
10
+ isTwitter: boolean | undefined;
11
+ videoId: string;
12
+ };
@@ -0,0 +1,24 @@
1
+ .container {
2
+ display: grid;
3
+ grid-template-columns: 382px;
4
+ gap: 27px;
5
+ justify-content: center;
6
+ }
7
+
8
+ .pagination-container {
9
+ display: flex;
10
+ justify-content: center;
11
+ margin-top: 36px;
12
+ }
13
+
14
+ @media (min-width: 790px) {
15
+ .container {
16
+ grid-template-columns: repeat(2, 382px);
17
+ }
18
+ }
19
+
20
+ @media (min-width: 1200px) {
21
+ .container {
22
+ grid-template-columns: repeat(3, 382px);
23
+ }
24
+ }
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <div class="container">
3
+ <template for:each={currentPageData} for:item="cardData">
4
+ <template lwc:if={cardData.isTwitter}>
5
+ <dx-embedded-video
6
+ key={cardData.id}
7
+ type="twitter"
8
+ video-id={cardData.videoId}
9
+ title={cardData.title}
10
+ body={cardData.body}
11
+ has-social={cardData.hasSocial}
12
+ social-name={cardData.socialName}
13
+ social-job-title={cardData.socialJobTitle}
14
+ social-profile-img-src={cardData.socialProfileImgSrc}
15
+ href={cardData.href}
16
+ ></dx-embedded-video>
17
+ </template>
18
+ <template lwc:elseif={cardData.isLinkedin}>
19
+ <dx-embedded-video
20
+ key={cardData.id}
21
+ type="linkedin"
22
+ video-id={cardData.videoId}
23
+ title={cardData.title}
24
+ body={cardData.body}
25
+ has-social={cardData.hasSocial}
26
+ social-name={cardData.socialName}
27
+ social-job-title={cardData.socialJobTitle}
28
+ social-profile-img-src={cardData.socialProfileImgSrc}
29
+ href={cardData.href}
30
+ ></dx-embedded-video>
31
+ </template>
32
+ </template>
33
+ </div>
34
+ <div class="pagination-container">
35
+ <dx-pagination
36
+ current-page={page}
37
+ total-pages={totalPages}
38
+ onpagechange={handlePageChange}
39
+ ></dx-pagination>
40
+ </div>
41
+ </template>
@@ -0,0 +1,41 @@
1
+ import { LightningElement, api } from "lwc";
2
+ import { VideoCardsData } from "./types";
3
+
4
+ export default class VideoGrid extends LightningElement {
5
+ @api cardLimit = 6;
6
+
7
+ @api
8
+ get cardsData(): Array<VideoCardsData> {
9
+ return this._cardsData;
10
+ }
11
+ set cardsData(value: string | Array<VideoCardsData>) {
12
+ if (typeof value === "string") {
13
+ try {
14
+ this._cardsData = JSON.parse(value) as Array<VideoCardsData>;
15
+ } catch (error) {
16
+ console.error("Error parsing cards data:", error);
17
+ this._cardsData = [];
18
+ }
19
+ } else {
20
+ this._cardsData = value;
21
+ }
22
+ }
23
+
24
+ private _cardsData: Array<VideoCardsData> = [];
25
+ private page = "1";
26
+
27
+ get totalPages(): string {
28
+ return String(Math.ceil(this.cardsData.length / this.cardLimit));
29
+ }
30
+
31
+ get currentPageData() {
32
+ return this.cardsData.slice(
33
+ this.page === "1" ? 0 : this.cardLimit * (Number(this.page) - 1),
34
+ this.cardLimit * Number(this.page)
35
+ );
36
+ }
37
+
38
+ private handlePageChange(e: CustomEvent): void {
39
+ this.page = String(e.detail);
40
+ }
41
+ }