From 64f67fd696a06a3d29c99ae80cfd1183a3430d3f Mon Sep 17 00:00:00 2001 From: Rafael Bardini Date: Fri, 5 Mar 2021 18:56:04 +0100 Subject: [PATCH] feat(icon): render profile network icons --- index.js | 7 +++++-- partials/header.hbs | 2 +- tap-snapshots/test-render.js-TAP.test.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index b565ac7..057bfdc 100644 --- a/index.js +++ b/index.js @@ -39,8 +39,11 @@ Handlebars.registerHelper('formatURL', url => url.replace(/^(https?:|)\/\//, '').replace(/\/$/, ''), ) -Handlebars.registerHelper('icon', name => - icons[name].toSvg({ width: 16, height: 16 }), +Handlebars.registerHelper('icon', (name, fallback) => + (icons[name.toLowerCase()] || icons[fallback.toLowerCase()]).toSvg({ + width: 16, + height: 16, + }), ) Handlebars.registerHelper('join', (arr, separator) => diff --git a/partials/header.hbs b/partials/header.hbs index 08178d3..0b367a6 100644 --- a/partials/header.hbs +++ b/partials/header.hbs @@ -36,7 +36,7 @@ {{/url}} {{#profiles}}
  • - {{{icon 'user'}}} + {{{icon network 'user'}}} {{#if username}} {{#if url}} {{username}} diff --git a/tap-snapshots/test-render.js-TAP.test.js b/tap-snapshots/test-render.js-TAP.test.js index aac03a0..dd1ffca 100644 --- a/tap-snapshots/test-render.js-TAP.test.js +++ b/tap-snapshots/test-render.js-TAP.test.js @@ -262,7 +262,7 @@ blockquote > * + * { richardhendricks.example.com
  • - + neutralthoughts (Twitter)