function updateIcons(update) { const icons = { ppt: "powerpoint", pptx: "powerpoint", doc: "word", docx: "word", xls: "xcel", xlsx: "xcel", pdf: "pdf", default: "page", }; return icons[update] ?? "page"; } <section class="fileDownload__wrapper"> <div class="fileDownload__icon icon__${updateIcons(fileType)}" aria-hidden="true"></div> </section>`;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter