@hulkapps/app-manager-vue 2.1.0 → 2.1.1

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": "@hulkapps/app-manager-vue",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Vue SDK to render app manager contents",
5
5
  "main": "dist/app-manager-vue.ssr.js",
6
6
  "browser": "dist/app-manager-vue.esm.js",
@@ -1,8 +1,50 @@
1
1
  <template>
2
+ <PSkeletonPage title="Skeleton Page"
3
+ :fullWidth="false"
4
+ primaryAction
5
+ :secondaryActions="2"
6
+ :breadcrumbs="false"
7
+ v-if="!plans.length">
8
+ <PLayout>
9
+ <PLayoutSection oneThird="">
10
+ <PCard sectioned="">
11
+ <PTextContainer>
12
+ <PSkeletonDisplayText size="small" />
13
+ <PSkeletonBodyText />
14
+ </PTextContainer>
15
+ </PCard>
16
+ </PLayoutSection>
17
+ <PLayoutSection oneThird="">
18
+ <PCard sectioned="">
19
+ <PTextContainer>
20
+ <PSkeletonDisplayText size="small" />
21
+ <PSkeletonBodyText />
22
+ </PTextContainer>
23
+ </PCard>
24
+ </PLayoutSection>
25
+ <PLayoutSection oneThird="">
26
+ <PCard sectioned="">
27
+ <PTextContainer>
28
+ <PSkeletonDisplayText size="small" />
29
+ <PSkeletonBodyText />
30
+ </PTextContainer>
31
+ </PCard>
32
+ </PLayoutSection>
33
+ </PLayout>
34
+ <PLayout style="margin-top: 20px">
35
+ <PLayoutSection>
36
+ <PCard sectioned=""><PSkeletonBodyText /></PCard>
37
+ <PCard sectioned=""><PSkeletonBodyText /></PCard>
38
+ <PCard sectioned=""><PSkeletonBodyText /></PCard>
39
+ <PCard sectioned=""><PSkeletonBodyText /></PCard>
40
+ </PLayoutSection>
41
+ </PLayout>
42
+ </PSkeletonPage>
2
43
  <PPage
3
44
  class="app-manager-plan-page custom-title"
4
45
  title="Choose plan"
5
46
  :subtitle = "subtitleContent"
47
+ v-else
6
48
  >
7
49
 
8
50
  <PStack slot="primaryAction">
@@ -163,11 +205,16 @@
163
205
  import {PDataTableCol} from "../polaris-vue/src/components/PDataTable/components/PDataTableCol";
164
206
  import {PDataTableRow} from "../polaris-vue/src/components/PDataTable/components/PDataTableRow";
165
207
  import {PIcon} from "../polaris-vue/src/components/PIcon";
208
+ import {PCard} from "../polaris-vue/src/components/PCard"
209
+ import {PCardSection} from "../polaris-vue/src/components/PCard/components/PCardSection"
210
+ import {PSkeletonPage} from "../polaris-vue/src/components/PSkeletonPage"
211
+ import {PSkeletonDisplayText} from "../polaris-vue/src/components/PSkeletonDisplayText"
212
+ import {PSkeletonBodyText} from "../polaris-vue/src/components/PSkeletonBodyText"
166
213
  import {PTextStyle} from "../polaris-vue/src/components/PTextStyle";
167
214
 
168
215
  export default {
169
216
  name: "AppManagerGroupPlan",
170
- components: { YearlyPlanPromotion, PlanBanners, PPage, PStack, PStackItem, PButton, PButtonGroup, PHeading, PLayout, PLayoutSection, PTextContainer, PDataTable, PDataTableCol, PDataTableRow, PIcon, PTextStyle },
217
+ components: { YearlyPlanPromotion, PlanBanners, PPage, PStack, PStackItem, PButton, PButtonGroup, PHeading, PLayout, PLayoutSection, PTextContainer, PDataTable, PDataTableCol, PDataTableRow, PIcon, PTextStyle, PCard, PCardSection, PSkeletonPage, PSkeletonBodyText, PSkeletonDisplayText },
171
218
  props: ['shop_domain'],
172
219
  data() {
173
220
  return {
@@ -345,6 +392,7 @@
345
392
  console.error(error)
346
393
  });
347
394
  this.features = featuresData.data.features;
395
+ this.features = this.features.filter((item) => item.hidden_feature !== true)
348
396
  this.features = this.features.sort((featureA, featureB) => parseInt(featureA.display_order) - parseInt(featureB.display_order))
349
397
  this.features = this.features.sort((featureA, featureB) => parseInt(featureA.group_order) - parseInt(featureB.group_order))
350
398
  this.featuresByGroup = this.groupBy(this.features, 'group')
@@ -554,4 +602,17 @@
554
602
  word-spacing: 999px;
555
603
  white-space: pre-line !important;
556
604
  }
605
+
606
+ .app-manager .app-manager-plan-page .Polaris-DataTable__Table {
607
+ table-layout: fixed !important;
608
+ }
609
+
610
+ .app-manager .app-manager-plan-page td {
611
+ vertical-align: middle !important;
612
+ }
613
+
614
+ .app-manager .app-manager-plan-page td.feature__class {
615
+ word-wrap:break-word !important;
616
+ white-space: normal !important;
617
+ }
557
618
  </style>
@@ -1,8 +1,50 @@
1
1
  <template>
2
+ <PSkeletonPage title="Skeleton Page"
3
+ :fullWidth="false"
4
+ primaryAction
5
+ :secondaryActions="2"
6
+ :breadcrumbs="false"
7
+ v-if="!plans.length">
8
+ <PLayout>
9
+ <PLayoutSection oneThird="">
10
+ <PCard sectioned="">
11
+ <PTextContainer>
12
+ <PSkeletonDisplayText size="small" />
13
+ <PSkeletonBodyText />
14
+ </PTextContainer>
15
+ </PCard>
16
+ </PLayoutSection>
17
+ <PLayoutSection oneThird="">
18
+ <PCard sectioned="">
19
+ <PTextContainer>
20
+ <PSkeletonDisplayText size="small" />
21
+ <PSkeletonBodyText />
22
+ </PTextContainer>
23
+ </PCard>
24
+ </PLayoutSection>
25
+ <PLayoutSection oneThird="">
26
+ <PCard sectioned="">
27
+ <PTextContainer>
28
+ <PSkeletonDisplayText size="small" />
29
+ <PSkeletonBodyText />
30
+ </PTextContainer>
31
+ </PCard>
32
+ </PLayoutSection>
33
+ </PLayout>
34
+ <PLayout style="margin-top: 20px">
35
+ <PLayoutSection>
36
+ <PCard sectioned=""><PSkeletonBodyText /></PCard>
37
+ <PCard sectioned=""><PSkeletonBodyText /></PCard>
38
+ <PCard sectioned=""><PSkeletonBodyText /></PCard>
39
+ <PCard sectioned=""><PSkeletonBodyText /></PCard>
40
+ </PLayoutSection>
41
+ </PLayout>
42
+ </PSkeletonPage>
2
43
  <PPage
3
44
  class="app-manager-plan-page-slider custom-title"
4
45
  title="Choose plan"
5
46
  :subtitle = "subtitleContent"
47
+ v-else
6
48
  >
7
49
 
8
50
  <PStack slot="primaryAction">
@@ -28,7 +70,7 @@
28
70
  <div class="Polaris-ResourceList__ResourceListWrapper features" style="width: 30%">
29
71
  <div class="plan__price"></div>
30
72
  <ul class="Polaris-ResourceList">
31
- <li class="Polaris-ResourceList__ItemWrapper pro_title" :class="`feature__type__${feature.value_type} feature__class`" v-for="(feature, key) in features" :key="key">
73
+ <li class="Polaris-ResourceList__ItemWrapper pro_title" :class="`${feature.value_type}__type__${feature.slug} feature__type__${feature.value_type} feature__class`" v-for="(feature, key) in features" :key="key">
32
74
  <div class="Polaris-ResourceList-Item__Container">
33
75
  <div class="Polaris-ResourceList-Item__Content">
34
76
  <h1 class="for-price-per-month"><span>{{ feature.name }}</span></h1>
@@ -42,8 +84,14 @@
42
84
  <template>
43
85
  <slide :id="key" :class="`slide-${key}`" v-for="(plan, key) in selectedPlan === 'monthly' ? monthlyPlan : yearlyPlan" :key="`slide-${key}`" >
44
86
  <div class="plan__price" :style="activePlanStyle(plan)">
45
- <b style="font-size: 16px">{{(plan.name)}}</b>
46
- <div v-if="plan.discount && plan.discount > 0" >
87
+ <div v-if="plan.price === 0">
88
+ <b v-if="plan.name !== 'Free'" style="font-size: 16px">{{(plan.name)}}</b>
89
+ <p style="display: flex;margin-top: 10px">
90
+ <PHeading style="font-size: 25px;font-weight: 700;">Free</PHeading>
91
+ </p>
92
+ </div>
93
+ <div v-else-if="plan.discount && plan.discount > 0" >
94
+ <b style="font-size: 16px">{{(plan.name)}}</b>
47
95
  <p style="display: flex;margin-top: 10px">
48
96
  <PHeading style="font-size: 25px;font-weight: 700;">${{parseFloat(calculateDiscountedPrice(plan)).toFixed(2)}}</PHeading>
49
97
  <b style="margin-top: 5px;font-size: 17px">/{{selectedPlan === 'monthly' ? ("mo") : ("year")}}</b>
@@ -54,15 +102,16 @@
54
102
  </p>
55
103
  </div>
56
104
  <div v-else>
105
+ <b style="font-size: 16px">{{(plan.name)}}</b>
57
106
  <p style="display: flex;margin-top: 10px">
58
107
  <PHeading style="font-size: 25px;font-weight: 700;">${{parseFloat(plan.price).toFixed(2)}}</PHeading>
59
- <b style="margin-top: 5px;font-size: 17px">/{{selectedPlan === 'monthly' ? ("mo") : ("year")}}</b>
108
+ <b style="margin-top: 5px;font-size: 17px">/{{selectedPlan === 'monthly' ? ("mo") : ("year")}}</b>
60
109
  </p>
61
110
  </div>
62
111
  </div>
63
112
  <div>
64
113
  <ul>
65
- <li v-for="(feature, key) in features" :class="`feature__type__${feature.value_type}`" :key="key" :style="activePlanStyle(plan)">
114
+ <li v-for="(feature, key) in features" :class="`${feature.value_type}__type__${feature.slug} feature__list feature__type__${feature.value_type}`" :key="key" :style="activePlanStyle(plan)">
66
115
  <div>
67
116
  <template v-if="plan.features && plan.features[feature.uuid]" style="display: flex">
68
117
  <template v-if="plan.features[feature.uuid].value_type === 'boolean'">
@@ -134,15 +183,21 @@
134
183
  import {PDataTableRow} from "../polaris-vue/src/components/PDataTable/components/PDataTableRow";
135
184
  import {PIcon} from "../polaris-vue/src/components/PIcon";
136
185
  import {PTextStyle} from "../polaris-vue/src/components/PTextStyle";
186
+ import {PCard} from "../polaris-vue/src/components/PCard"
187
+ import {PCardSection} from "../polaris-vue/src/components/PCard/components/PCardSection"
188
+ import {PSkeletonPage} from "../polaris-vue/src/components/PSkeletonPage"
189
+ import {PSkeletonDisplayText} from "../polaris-vue/src/components/PSkeletonDisplayText"
190
+ import {PSkeletonBodyText} from "../polaris-vue/src/components/PSkeletonBodyText"
137
191
  import {Carousel, Slide} from 'vue-carousel';
138
192
 
139
193
  export default {
140
194
  name: "AppManagerSliderPlan",
141
- components: { Carousel, Slide, YearlyPlanPromotion, PlanBanners, PPage, PStack, PStackItem, PButton, PButtonGroup, PHeading, PLayout, PLayoutSection, PTextContainer, PDataTable, PDataTableCol, PDataTableRow, PIcon, PTextStyle },
195
+ components: { Carousel, Slide, YearlyPlanPromotion, PlanBanners, PPage, PStack, PStackItem, PButton, PButtonGroup, PHeading, PLayout, PLayoutSection, PTextContainer, PDataTable, PDataTableCol, PDataTableRow, PIcon, PTextStyle, PCardSection, PCard, PSkeletonDisplayText, PSkeletonBodyText, PSkeletonPage },
142
196
  props: ['shop_domain'],
143
197
  data() {
144
198
  return {
145
- perPage: 4,
199
+ slideLength : 0,
200
+ perPage: 0,
146
201
  currentSlide: 0,
147
202
  plan: {},
148
203
  plans: [],
@@ -320,27 +375,54 @@
320
375
  this.selectedPlan = value;
321
376
  this.$nextTick(() => {
322
377
 
323
- let maxHeight = 0
324
- let elements = document.querySelectorAll('.feature__type__array');
325
- elements.forEach((item) => {
326
- item.style.minHeight = 'unset';
327
- console.log(item.offsetHeight)
328
- if (maxHeight < item.offsetHeight) {
329
- maxHeight = item.offsetHeight
330
- }
331
- });
332
- elements.forEach((item) => {
333
- item.style.minHeight = maxHeight + 'px';
334
- });
378
+ this.slideLength = this.selectedPlan === 'monthly' ? this.monthlyPlan.length : this.yearlyPlan.length;
379
+ this.perPage = this.slideLength >= 4 ? 4 : this.slideLength;
335
380
 
336
- let element = document.querySelector('.slide-0');
337
- if (element) {
338
- element.classList.add('first-slide')
339
- element = document.querySelector('.slide-3');
340
- element.classList.add('last-slide')
341
- document.querySelector('.VueCarousel-navigation-button.VueCarousel-navigation-prev').style.left = -document.querySelector('.Polaris-ResourceList__ResourceListWrapper.features').offsetWidth + 'px';
381
+ // calculate and reset height of rows
382
+ this.features.forEach((feature) => {
383
+ let className = feature.value_type + '__type__' + feature.slug;
384
+ let elements = document.querySelectorAll('.' + className);
385
+ let maxHeight = 0;
386
+ elements.forEach((item) => {
387
+ item.style.minHeight = 'unset';
388
+ if (maxHeight < item.offsetHeight) {
389
+ maxHeight = item.offsetHeight
390
+ }
391
+ });
392
+ elements.forEach((item) => {
393
+ item.style.minHeight = maxHeight + 'px';
394
+ });
395
+ })
396
+
397
+ // remove first-slide and last-slide classes
398
+ let allSlides = document.getElementsByClassName('VueCarousel-slide');
399
+ for (let i=0, max=allSlides.length; i < max; i++) {
400
+ let slide = document.getElementById(allSlides[i].id);
401
+ slide.classList.remove('first-slide')
402
+ slide.classList.remove('last-slide')
342
403
  }
343
404
 
405
+ // add first-slide and last-slide classes
406
+ let pagesCount = this.slideLength;
407
+ setTimeout(() => {
408
+ let element = document.querySelector('.slide-0');
409
+ if (element) {
410
+ element.classList.add('first-slide')
411
+ if (pagesCount < 4) {
412
+ let lastSlideClass = '.slide-' + (pagesCount-1)
413
+ element = document.querySelector(lastSlideClass);
414
+ element.classList.add('last-slide')
415
+ }
416
+ else {
417
+ element = document.querySelector('.slide-3');
418
+ element.classList.add('last-slide')
419
+ }
420
+ if (document.querySelector('.VueCarousel-navigation-button.VueCarousel-navigation-prev')) {
421
+ document.querySelector('.VueCarousel-navigation-button.VueCarousel-navigation-prev').style.left = -document.querySelector('.Polaris-ResourceList__ResourceListWrapper.features').offsetWidth + 'px';
422
+ }
423
+ }
424
+ }, 100)
425
+
344
426
  });
345
427
  },
346
428
  headerClasses(firstColumn) {
@@ -358,6 +440,7 @@
358
440
  console.error(error)
359
441
  });
360
442
  this.features = featuresData.data.features;
443
+ this.features = this.features.filter((item) => item.hidden_feature !== true)
361
444
  this.features = this.features.sort((featureA, featureB) => parseInt(featureA.display_order) - parseInt(featureB.display_order))
362
445
 
363
446
  const plansData = await axios.get(`${this.app_manager_config.baseUrl}/api/app-manager/plans`, { params: { 'shop_domain': this.shop_domain } }).catch(error => {
@@ -378,25 +461,67 @@
378
461
 
379
462
  this.$nextTick(() => {
380
463
 
381
- let maxHeight = 0
382
- let elements = document.querySelectorAll('.feature__type__array');
383
- elements.forEach((item) => {
384
- if (maxHeight < item.offsetHeight) {
385
- maxHeight = item.offsetHeight
386
- }
387
- });
388
- elements.forEach((item) => {
389
- item.style.minHeight = maxHeight + 'px';
390
- });
464
+ // calculate height of cell
465
+ setTimeout(() => {
391
466
 
392
- let element = document.querySelector('.slide-0');
393
- if (element) {
394
- element.classList.add('first-slide')
395
- element = document.querySelector('.slide-3');
396
- element.classList.add('last-slide')
397
- document.querySelector('.VueCarousel-navigation-button.VueCarousel-navigation-prev').style.left = -document.querySelector('.Polaris-ResourceList__ResourceListWrapper.features').offsetWidth + 'px';
467
+ let elements = document.querySelectorAll('.plan__price');
468
+ let maxHeight = 0;
469
+ elements.forEach((item) => {
470
+ if (maxHeight < item.offsetHeight) {
471
+ maxHeight = item.offsetHeight
472
+ }
473
+ });
474
+ elements.forEach((item) => {
475
+ item.style.minHeight = maxHeight + 'px';
476
+ });
477
+
478
+ this.features.forEach((feature) => {
479
+ let className = feature.value_type + '__type__' + feature.slug;
480
+ elements = document.querySelectorAll('.' + className);
481
+ maxHeight = 0;
482
+ elements.forEach((item) => {
483
+ if (maxHeight < item.offsetHeight) {
484
+ maxHeight = item.offsetHeight
485
+ }
486
+ });
487
+ elements.forEach((item) => {
488
+ item.style.minHeight = maxHeight + 'px';
489
+ });
490
+ })
491
+ }, 100);
492
+
493
+ // remove fist-slide and last-slide classes from all slides
494
+ let allSlides = document.getElementsByClassName('VueCarousel-slide');
495
+ for (let i=0, max=allSlides.length; i < max; i++) {
496
+ let slide = document.getElementById(allSlides[i].id);
497
+ slide.classList.remove('first-slide')
498
+ slide.classList.remove('last-slide')
398
499
  }
399
500
 
501
+ // add first-slide and last-slide
502
+ this.slideLength = this.selectedPlan === 'monthly' ? this.monthlyPlan.length : this.yearlyPlan.length;
503
+ this.perPage = this.slideLength >= 4 ? 4 : this.slideLength;
504
+
505
+ let pagesCount = this.slideLength;
506
+ setTimeout(() => {
507
+ let element = document.querySelector('.slide-0');
508
+ if (element) {
509
+ element.classList.add('first-slide')
510
+ if (pagesCount < 4) {
511
+ let lastSlideClass = '.slide-' + (pagesCount-1)
512
+ element = document.querySelector(lastSlideClass);
513
+ element.classList.add('last-slide')
514
+ }
515
+ else {
516
+ element = document.querySelector('.slide-3');
517
+ element.classList.add('last-slide')
518
+ }
519
+ if (document.querySelector('.VueCarousel-navigation-button.VueCarousel-navigation-prev')) {
520
+ document.querySelector('.VueCarousel-navigation-button.VueCarousel-navigation-prev').style.left = -document.querySelector('.Polaris-ResourceList__ResourceListWrapper.features').offsetWidth + 'px';
521
+ }
522
+ }
523
+ }, 100)
524
+
400
525
  });
401
526
  },
402
527
  }
@@ -489,6 +614,7 @@
489
614
  margin-left: 0px !important;
490
615
  z-index: unset !important;
491
616
  }
617
+ .app-manager .app-manager-plan-page-slider .feature__list,
492
618
  .app-manager .app-manager-plan-page-slider .feature__type__array
493
619
  {
494
620
  display: flex;
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div class="Polaris-SkeletonBodyText__SkeletonBodyTextContainer">
3
+ <div v-for="(line, i) in lines" :key="i" class="Polaris-SkeletonBodyText"/>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+
9
+ /**
10
+ * <br/>
11
+ * <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
12
+ * sans-serif;">Skeleton body text is used to provide a low fidelity representation of content before it appears on the
13
+ * page, and improves load times perceived by merchants. Can be used for content in or outside of a card.</h4>
14
+ */
15
+ export default {
16
+ name: 'PSkeletonBodyText',
17
+ props: {
18
+ /**
19
+ * Number of line of skeleton
20
+ */
21
+ lines: {
22
+ type: Number,
23
+ default: 3
24
+ }
25
+ }
26
+ }
27
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div :class="className"></div>
3
+ </template>
4
+
5
+ <script>
6
+ import { classNames, variationName } from '../../utilities/css';
7
+ import StringValidator from '../../utilities/validators/StringValidator';
8
+
9
+ const Size = ['small', 'medium', 'large', 'extraLarge'];
10
+
11
+ /**
12
+ * <br/>
13
+ * <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
14
+ * sans-serif;">Skeleton display text is used to provide a low fidelity representation of content before it appears on
15
+ * the page, and improves load times perceived by merchants. Can be used for content in or outside of a card.</h4>
16
+ */
17
+ export default {
18
+ name: 'PSkeletonDisplayText',
19
+ props: {
20
+ /**
21
+ * Size of Skeleton.
22
+ */
23
+ size: {
24
+ type: String,
25
+ default: 'medium',
26
+ ...StringValidator('size', Size)
27
+ }
28
+ },
29
+ computed: {
30
+ className() {
31
+ return classNames(
32
+ 'Polaris-SkeletonDisplayText__DisplayText',
33
+ this.size && `Polaris-SkeletonDisplayText--${variationName('size', this.size)}`,
34
+ );
35
+ }
36
+ },
37
+ }
38
+ </script>
@@ -0,0 +1,149 @@
1
+ <template>
2
+ <div
3
+ :class="className"
4
+ role="status"
5
+ aria-label="Page loading"
6
+ >
7
+ <div class="Polaris-SkeletonPage__Header">
8
+ <div
9
+ v-if="breadcrumbs"
10
+ class="Polaris-SkeletonPage__BreadcrumbAction"
11
+ style="width: 60px;"
12
+ >
13
+ <PSkeletonBodyText :lines="1"/>
14
+ </div>
15
+ <div class="Polaris-SkeletonPage__TitleAndPrimaryAction">
16
+ <div class="Polaris-SkeletonPage__TitleWrapper">
17
+ <h1 v-if="title !== null" class="Polaris-SkeletonPage__Title">
18
+ {{ title }}
19
+ </h1>
20
+ <div v-else class="Polaris-SkeletonPage__SkeletonTitle" />
21
+ </div>
22
+ <div
23
+ v-if="primaryAction"
24
+ class="Polaris-SkeletonPage__PrimaryAction"
25
+ >
26
+ <PSkeletonDisplayText size="large"/>
27
+ </div>
28
+ </div>
29
+ <div
30
+ v-if="secondaryActions !== 0"
31
+ class="Polaris-SkeletonPage__Actions"
32
+ >
33
+ <div
34
+ v-for="renderSecondaryAction in renderSecondaryActions(secondaryActions)"
35
+ :key="renderSecondaryAction.key"
36
+ class="Polaris-SkeletonPage__Action"
37
+ :style="renderSecondaryAction.width"
38
+ >
39
+ <PSkeletonBodyText :lines="1"/>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ <div class="Polaris-SkeletonPage__Content">
44
+ <!-- @slot The child elements to render in the skeleton page -->
45
+ <slot/>
46
+ </div>
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ import { classNames } from '../../utilities/css';
52
+ import { PSkeletonBodyText } from '../../components/PSkeletonBodyText';
53
+ import { PSkeletonDisplayText } from '../../components/PSkeletonDisplayText';
54
+
55
+ /**
56
+ * <br/>
57
+ * <h4 style="font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue,
58
+ * sans-serif;">Skeleton page is used with other skeleton loading components to provide a low fidelity representation
59
+ * of the user interface (UI) before content appears on the page. It improves load times perceived by merchants.</h4>
60
+ */
61
+ export default {
62
+ name: 'PSkeletonPage',
63
+ components: {
64
+ PSkeletonBodyText, PSkeletonDisplayText,
65
+ },
66
+ props: {
67
+ /**
68
+ * Page title, in large type
69
+ */
70
+ title: {
71
+ type: String,
72
+ default: null
73
+ },
74
+
75
+ /**
76
+ * Remove the normal max-width on the page
77
+ */
78
+ fullWidth: {
79
+ type: Boolean,
80
+ default: false
81
+ },
82
+
83
+ /**
84
+ * Decreases the maximum layout width. Intended for single-column layouts
85
+ */
86
+ narrowWidth: {
87
+ type: Boolean,
88
+ default: false
89
+ },
90
+
91
+ /**
92
+ * Shows a skeleton over the primary action
93
+ */
94
+ primaryAction: {
95
+ type: Boolean,
96
+ default: false
97
+ },
98
+
99
+ /**
100
+ * Number of secondary page-level actions to display
101
+ */
102
+ secondaryActions: {
103
+ type: Number,
104
+ },
105
+
106
+ /**
107
+ * Shows a skeleton over the breadcrumb
108
+ */
109
+ breadcrumbs: {
110
+ type: Boolean,
111
+ default: false,
112
+ },
113
+ },
114
+ computed: {
115
+ className() {
116
+ return classNames(
117
+ 'Polaris-SkeletonPage__Page',
118
+ this.fullWidth && 'Polaris-SkeletonPage--fullWidth',
119
+ this.narrowWidth && 'Polaris-SkeletonPage--narrowWidth',
120
+ );
121
+ },
122
+ },
123
+ methods: {
124
+ renderSecondaryActions(actionCount) {
125
+ if(typeof actionCount === 'number') {
126
+ const actions = [];
127
+ for (let i = 0; i < actionCount; i++) {
128
+ const width = Math.round(Math.random() * 40 + 60);
129
+ actions.push(
130
+ {
131
+ width: {
132
+ /* tslint:disable-next-line */
133
+ 'width': `${width}px`,
134
+ },
135
+ key: i,
136
+ },
137
+ );
138
+ }
139
+
140
+ return actions;
141
+ }
142
+ }
143
+ }
144
+ }
145
+ </script>
146
+
147
+ <style scoped>
148
+
149
+ </style>