cec-nuxt-lib 0.4.6 → 0.4.8

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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "cec-nuxt-lib",
3
3
  "configKey": "cec-nuxt-lib",
4
- "version": "0.4.6"
4
+ "version": "0.4.8"
5
5
  }
@@ -26,7 +26,7 @@ const sizeString = (n) => {
26
26
  if (n < 1000) {
27
27
  return `${n}B`;
28
28
  } else if (n < 1000 * 1000) {
29
- return `${(n / 1000).toFixed(2)}KB`;
29
+ return `${Math.ceil(n / 1000)}KB`;
30
30
  } else {
31
31
  return `${(n / 1000 / 1000).toFixed(2)}MB`;
32
32
  }
@@ -39,6 +39,11 @@ const abbr = (data) => {
39
39
  return `<abbr title="${text(data.entryDescription)}">${text(data.entryTitle)}</abbr>`;
40
40
  };
41
41
 
42
+ const accWithAssets = (props: any) => {
43
+ let data = { ...props.block.value, id: props.block.id };
44
+ return accordion(data);
45
+ };
46
+
42
47
  const accordion = (data) => {
43
48
  if (!data.id) {
44
49
  data.id = data.sys.id;
@@ -65,6 +70,20 @@ const accordion = (data) => {
65
70
  `;
66
71
  data.accordionSection.forEach((e, i) => {
67
72
  let accId = `${data.id}_${i}`;
73
+ if (e.pdfs?.length) {
74
+ let pdfs = e.pdfs.reduce((acc, p) => {
75
+ return (
76
+ acc +
77
+ `<li>
78
+ <a href="${processUri(p.sys.uri)}"
79
+ >${p.title[0].toUpperCase()}${p.title.slice(1)}
80
+ (${p.sys.contentTypeId.toUpperCase()},
81
+ ${sizeString(p.sys.properties.fileSize)})
82
+ </a></li>`
83
+ );
84
+ }, '<ul>');
85
+ e.content = `${e.content ? e.content : ''}${pdfs}</ul>`;
86
+ }
68
87
  let article = `${e.content ? e.content : ''}${e.genericList ? genList(e.genericList, accId) : ''}`;
69
88
  if (!article.length) {
70
89
  article = '<p>Nothing to display at present</p>';
@@ -675,6 +694,7 @@ const renderer = createRenderer({
675
694
  accordionComponent: accordionComponent,
676
695
  cecButton: cecButton,
677
696
  centralColumn: centralColumn,
697
+ dragonsLaneAccordion: accWithAssets,
678
698
  fullWidthImageWithOverlay: fullWidthImageWithOverlay,
679
699
  fullWidthImageWithSideOverlay: fullWidthImageWithSideOverlay,
680
700
  centralPromotionalSection: centralPromotionalSection,
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.4.6",
2
+ "version": "0.4.8",
3
3
  "name": "cec-nuxt-lib",
4
4
  "description": "Nuxt components and assets",
5
5
  "license": "MIT",