feat: dynamic avatar font size

This commit is contained in:
Bettenbuk Zoltan 2019-07-03 18:23:00 +02:00 committed by Zoltan Bettenbuk
parent a04982fd96
commit a35b36d6df
2 changed files with 31 additions and 1 deletions

View File

@ -9,6 +9,23 @@
object-fit: cover;
}
.avatar-foreign {
align-items: center;
bottom: 0;
display: flex;
font-size: 40pt;
justify-content: center;
left: 0;
position: absolute;
right: 0;
top: 0;
}
.avatar-svg {
height: 100%;
width: 100%;
}
.defaultAvatar {
opacity: 0.6
}

View File

@ -52,7 +52,20 @@ export default class StatelessAvatar extends AbstractStatelessAvatar<Props> {
className = { this._getAvatarClassName() }
id = { this.props.id }
style = { this._getAvatarStyle(this.props.color) }>
{ initials }
<svg
className = 'avatar-svg'
viewBox = '0 0 100 100'
xmlns = 'http://www.w3.org/2000/svg'
xmlnsXlink = 'http://www.w3.org/1999/xlink'>
<foreignObject
height = '100%'
width = '100%'>
<span
className = 'avatar-foreign'>
{ initials }
</span>
</foreignObject>
</svg>
</div>
);
}