2018-05-02 02:05:36 +02:00
|
|
|
{#if error}
|
2018-08-23 06:00:53 +02:00
|
|
|
<svg class={computedClass} style={svgStyle} aria-hidden="true">
|
2018-12-10 09:13:54 +01:00
|
|
|
<use xlink:href="#fa-user" />
|
2018-01-15 06:41:19 +01:00
|
|
|
</svg>
|
2018-05-02 02:05:36 +02:00
|
|
|
{:elseif $autoplayGifs}
|
2018-08-23 06:00:53 +02:00
|
|
|
<LazyImage
|
|
|
|
className={computedClass}
|
|
|
|
ariaHidden="true"
|
2018-12-08 18:42:38 +01:00
|
|
|
forceSize=true
|
2018-04-30 01:57:12 +02:00
|
|
|
alt=""
|
2018-05-02 02:05:36 +02:00
|
|
|
src={account.avatar}
|
2018-08-23 06:00:53 +02:00
|
|
|
{width}
|
|
|
|
{height}
|
2018-04-30 01:57:12 +02:00
|
|
|
on:imgLoad="set({loaded: true})"
|
|
|
|
on:imgLoadError="set({error: true})" />
|
2018-05-02 02:05:36 +02:00
|
|
|
{:else}
|
2018-04-30 01:57:12 +02:00
|
|
|
<NonAutoplayImg
|
2018-05-02 02:05:36 +02:00
|
|
|
className={computedClass}
|
2018-04-30 01:57:12 +02:00
|
|
|
ariaHidden="true"
|
|
|
|
alt=""
|
2018-05-02 02:05:36 +02:00
|
|
|
src={account.avatar}
|
|
|
|
staticSrc={account.avatar_static}
|
2018-08-23 06:00:53 +02:00
|
|
|
{width}
|
|
|
|
{height}
|
2018-05-02 02:05:36 +02:00
|
|
|
{isLink}
|
2018-04-30 01:57:12 +02:00
|
|
|
on:imgLoad="set({loaded: true})"
|
|
|
|
on:imgLoadError="set({error: true})"
|
2018-03-17 02:48:24 +01:00
|
|
|
/>
|
2018-05-02 02:05:36 +02:00
|
|
|
{/if}
|
2018-01-11 05:45:02 +01:00
|
|
|
<style>
|
2018-02-01 03:20:30 +01:00
|
|
|
:global(.avatar) {
|
|
|
|
border-radius: 4px;
|
2018-04-09 02:36:05 +02:00
|
|
|
background: var(--loading-bg);
|
2018-02-01 03:20:30 +01:00
|
|
|
}
|
2018-03-23 05:36:19 +01:00
|
|
|
|
2018-04-30 01:57:12 +02:00
|
|
|
:global(.avatar.loaded) {
|
|
|
|
background: none;
|
|
|
|
}
|
|
|
|
|
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>
|
2018-02-09 02:56:20 +01:00
|
|
|
import { store } from '../_store/store'
|
|
|
|
import NonAutoplayImg from './NonAutoplayImg.html'
|
2018-04-30 01:57:12 +02:00
|
|
|
import { classname } from '../_utils/classname'
|
2018-08-23 06:00:53 +02:00
|
|
|
import LazyImage from './LazyImage.html'
|
2018-01-23 06:47:29 +01:00
|
|
|
|
2018-01-11 05:45:02 +01:00
|
|
|
export default {
|
2018-04-30 07:13:41 +02:00
|
|
|
data: () => ({
|
|
|
|
className: void 0,
|
|
|
|
loaded: false,
|
|
|
|
error: void 0,
|
2019-02-23 05:35:19 +01:00
|
|
|
isLink: false,
|
|
|
|
size: 'medium'
|
2018-04-30 07:13:41 +02:00
|
|
|
}),
|
2018-02-01 03:20:30 +01:00
|
|
|
store: () => store,
|
2018-04-30 01:57:12 +02:00
|
|
|
computed: {
|
2018-08-23 06:00:53 +02:00
|
|
|
computedClass: ({ className, loaded }) => (classname(
|
2018-04-30 01:57:12 +02:00
|
|
|
'avatar',
|
|
|
|
className,
|
2018-08-23 06:00:53 +02:00
|
|
|
loaded && 'loaded'
|
|
|
|
)),
|
|
|
|
width: ({ size, $isMobileSize }) => {
|
|
|
|
switch (size) {
|
|
|
|
case 'extra-small':
|
|
|
|
return 24
|
|
|
|
case 'small':
|
|
|
|
return 48
|
|
|
|
case 'big':
|
|
|
|
return $isMobileSize ? 80 : 100
|
|
|
|
case 'medium':
|
|
|
|
default:
|
|
|
|
return 64
|
|
|
|
}
|
|
|
|
},
|
|
|
|
height: ({ width }) => width,
|
|
|
|
svgStyle: ({ width, height }) => `width: ${width}px; height: ${height}px;`
|
2018-04-30 01:57:12 +02:00
|
|
|
},
|
2018-02-01 03:20:30 +01:00
|
|
|
components: {
|
2018-08-23 06:00:53 +02:00
|
|
|
NonAutoplayImg,
|
|
|
|
LazyImage
|
2018-01-15 06:41:19 +01:00
|
|
|
}
|
2018-01-11 05:45:02 +01:00
|
|
|
}
|
2018-12-08 18:42:38 +01:00
|
|
|
</script>
|