feat(icon): render profile network icons

This commit is contained in:
Rafael Bardini 2021-03-05 18:56:04 +01:00
parent 6ef017ac42
commit 64f67fd696
3 changed files with 7 additions and 4 deletions

View File

@ -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) =>

View File

@ -36,7 +36,7 @@
{{/url}}
{{#profiles}}
<li>
{{{icon 'user'}}}
{{{icon network 'user'}}}
{{#if username}}
{{#if url}}
<a href="{{url}}">{{username}}</a>

View File

@ -262,7 +262,7 @@ blockquote > * + * {
<a href="http://richardhendricks.example.com">richardhendricks.example.com</a>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-twitter"><path d="M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z"></path></svg>
neutralthoughts
<span class="network">(Twitter)</span>
</li>