From e7d1eda59fea9deb678c3fe1b0306b3fbaf13be7 Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Wed, 6 Nov 2024 15:24:30 +1100 Subject: [PATCH] feat(@dpc-sdp/ripple-ui-core): :sparkles: add icon-file-secure --- .../utils/markup-transpiler/cheerio.test.ts | 34 +++++++++++++++++-- .../markup-transpiler/default-plugins.ts | 8 +++-- .../assets/icons/core/icon-file-secure.svg | 4 +++ .../ripple-ui-core/src/assets/icons/sprite.js | 2 +- .../src/assets/icons/sprite.svg | 2 +- .../src/components/icon/constants.ts | 1 + 6 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 packages/ripple-ui-core/src/assets/icons/core/icon-file-secure.svg diff --git a/packages/ripple-tide-api/src/utils/markup-transpiler/cheerio.test.ts b/packages/ripple-tide-api/src/utils/markup-transpiler/cheerio.test.ts index 2cfe80fa21..e7309c4186 100644 --- a/packages/ripple-tide-api/src/utils/markup-transpiler/cheerio.test.ts +++ b/packages/ripple-tide-api/src/utils/markup-transpiler/cheerio.test.ts @@ -11,7 +11,10 @@ const markup = { callout: `

Hey it's a callout

And another callout

This one is wysiwyg
`, quotation: `

It was the best of times, it was the blurst of times.

Chimp 273
`, - document: `
File
`, + document: [ + `
File
`, + `
` + ], video: `
Caption goes here`, image: `
Image
`, button: `Button`, @@ -36,7 +39,8 @@ const fixed = {
Chimp 273
`, - document: ` + document: [ + `
@@ -53,6 +57,24 @@ const fixed = {
`, + ` +
+ + + + +
+ Secure document +
+ PDF + 139.44 KB +
Updated 24 Sept 2024
+
+ (opens in a new window) +
+
+` + ], video: `
@@ -78,7 +100,13 @@ const fixed = { describe('ripple-tide-api/utils/markup-transpiler/cheerio', () => { for (const [label, html] of Object.entries(markup)) { it(`runs ${label} plugin on markup`, () => { - expect(markupTranspiler(html)).toEqual(fixed[label]) + if (Array.isArray(html)) { + html.forEach((entry, i) => { + expect(markupTranspiler(entry)).toEqual(fixed[label][i]) + }) + } else { + expect(markupTranspiler(html)).toEqual(fixed[label]) + } }) } }) diff --git a/packages/ripple-tide-api/src/utils/markup-transpiler/default-plugins.ts b/packages/ripple-tide-api/src/utils/markup-transpiler/default-plugins.ts index 5572d5519d..08ed5ddd46 100644 --- a/packages/ripple-tide-api/src/utils/markup-transpiler/default-plugins.ts +++ b/packages/ripple-tide-api/src/utils/markup-transpiler/default-plugins.ts @@ -124,11 +124,15 @@ const pluginDocuments = function (this: any) { }) } + const mediaIcon = $element.hasClass('embedded-entity--media--secure-file') + ? 'file-secure' + : 'document-lined' + return $element.replaceWith(`
- - + +
${title} diff --git a/packages/ripple-ui-core/src/assets/icons/core/icon-file-secure.svg b/packages/ripple-ui-core/src/assets/icons/core/icon-file-secure.svg new file mode 100644 index 0000000000..999be8f08a --- /dev/null +++ b/packages/ripple-ui-core/src/assets/icons/core/icon-file-secure.svg @@ -0,0 +1,4 @@ + + + diff --git a/packages/ripple-ui-core/src/assets/icons/sprite.js b/packages/ripple-ui-core/src/assets/icons/sprite.js index 30cbbe3b5a..6341d5ff68 100644 --- a/packages/ripple-ui-core/src/assets/icons/sprite.js +++ b/packages/ripple-ui-core/src/assets/icons/sprite.js @@ -1 +1 @@ -export default ["icon-cancel","icon-check-circle-filled","icon-chevron-down","icon-chevron-left","icon-chevron-right","icon-chevron-up","icon-current-location","icon-document-lined","icon-document","icon-download","icon-enlarge-square-filled","icon-enlarge","icon-exclamation-circle-filled","icon-facebook","icon-home","icon-information-circle-filled","icon-link-external-square-filled","icon-linkedin","icon-mail","icon-phone","icon-pin","icon-twitter","icon-view","icon-whatsapp","icon-x"] \ No newline at end of file +export default ["icon-cancel","icon-check-circle-filled","icon-chevron-down","icon-chevron-left","icon-chevron-right","icon-chevron-up","icon-current-location","icon-document-lined","icon-document","icon-download","icon-enlarge-square-filled","icon-enlarge","icon-exclamation-circle-filled","icon-facebook","icon-file-secure","icon-home","icon-information-circle-filled","icon-link-external-square-filled","icon-linkedin","icon-mail","icon-phone","icon-pin","icon-twitter","icon-view","icon-whatsapp","icon-x"] \ No newline at end of file diff --git a/packages/ripple-ui-core/src/assets/icons/sprite.svg b/packages/ripple-ui-core/src/assets/icons/sprite.svg index a05c014b64..a49815ab93 100644 --- a/packages/ripple-ui-core/src/assets/icons/sprite.svg +++ b/packages/ripple-ui-core/src/assets/icons/sprite.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/packages/ripple-ui-core/src/components/icon/constants.ts b/packages/ripple-ui-core/src/components/icon/constants.ts index 0c3309b69f..0d1bdc4c73 100644 --- a/packages/ripple-ui-core/src/components/icon/constants.ts +++ b/packages/ripple-ui-core/src/components/icon/constants.ts @@ -54,6 +54,7 @@ export const RplIconGroups = { 'icon-enlarge', 'icon-enlarge-square-filled', 'icon-exclamation-circle-filled', + 'icon-file-secure', 'icon-free', 'icon-home', 'icon-information-circle-filled',