pinafore/routes/_components/Avatar.html

34 lines
679 B
HTML
Raw Normal View History

2018-01-21 06:06:30 +01:00
{{#if error}}
2018-01-18 08:00:33 +01:00
<svg class="{{className}} avatar" aria-hidden="true">
2018-01-15 06:41:19 +01:00
<use xlink:href="#fa-user" />
</svg>
2018-01-21 06:06:30 +01:00
{{else}}
<img class="{{className}} avatar" aria-hidden="true" alt=""
src="{{account.avatar}}" on:loadError="set({error: true})" />
{{/if}}
2018-01-11 05:45:02 +01:00
<style>
2018-01-16 17:38:23 +01:00
.avatar {
2018-01-11 09:26:35 +01:00
width: 48px;
height: 48px;
2018-01-11 05:45:02 +01:00
border-radius: 4px;
}
2018-01-15 06:41:19 +01:00
2018-01-16 17:38:23 +01:00
svg.avatar {
2018-01-15 06:41:19 +01:00
fill: var(--deemphasized-text-color);
}
2018-01-11 05:45:02 +01:00
</style>
<script>
export default {
2018-01-21 06:06:30 +01:00
events: {
loadError (node, callback) {
node.addEventListener('error', callback)
return {
teardown () {
node.removeEventListener('error', callback)
}
}
},
2018-01-15 06:41:19 +01:00
}
2018-01-11 05:45:02 +01:00
}
</script>