Skip to content

Commit

Permalink
icon display update
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrancart committed Sep 22, 2024
1 parent f3cb725 commit eaba275
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/sparnatural-yasr-plugin-grid/Display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ export class DisplayBoxHtml {
documentTypeContainer.className = "document-type-container";
const documentTypeLabel = document.createElement("div");
documentTypeLabel.className = "document-type-label";
// build the icon HTML
let iconHtml = '';
if(resultBox.typeResultBox.icon && resultBox.typeResultBox.icon.startsWith("<")) {
// old Sparnatural : icon is returned with outer span
iconHtml = resultBox.typeResultBox.icon;
} else if(resultBox.typeResultBox.icon) {
// new Sparnatural : icon is returned with just the code
iconHtml = `<i style="font-size:180%" class="${resultBox.typeResultBox.icon}"></i>`
}
documentTypeLabel.innerHTML = `${resultBox.typeResultBox.icon}<strong>${resultBox.typeResultBox.label}</strong>`;
documentTypeContainer.appendChild(documentTypeLabel);
//ajouter le type de document au container general
Expand Down Expand Up @@ -408,10 +417,21 @@ export class DisplayBoxHtml {

const documentTypeLabel = document.createElement("div");
documentTypeLabel.className = "document-type-label-wo-image";
if (resultBox.typeResultBox.icon) {
documentTypeLabel.innerHTML = `${resultBox.typeResultBox.icon}`;

// build the icon HTML
let iconHtml = '';
if(resultBox.typeResultBox.icon && resultBox.typeResultBox.icon.startsWith("<")) {
// old Sparnatural : icon is returned with outer span
iconHtml = resultBox.typeResultBox.icon;
} else if(resultBox.typeResultBox.icon) {
// new Sparnatural : icon is returned with just the code
iconHtml = `<i style="font-size:180%" class="${resultBox.typeResultBox.icon}"></i>`
}

if (iconHtml) {
documentTypeLabel.innerHTML = `${iconHtml}`;
} else {
documentTypeLabel.innerHTML = `${resultBox.typeResultBox.icon}<strong>${resultBox.typeResultBox.label}</strong>`;
documentTypeLabel.innerHTML = `<strong>${resultBox.typeResultBox.label}</strong>`;
}
const titleElement = document.createElement("div");
titleElement.className = "main-title-wo-image";
Expand Down

0 comments on commit eaba275

Please sign in to comment.