Fixed avatar styling in conjunction with the size values

This commit is contained in:
Grzegorz Leoniec 2019-03-15 13:29:30 +01:00
parent b3bde1aa2a
commit c8002a2b9a
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377

View File

@ -29,6 +29,9 @@
<script>
import helpers from './lib/helpers.js'
import { tokens } from '@@/tokens'
import camelCase from 'lodash/camelCase'
import upperFirst from 'lodash/upperFirst'
export default {
name: 'DsAvatar',
@ -59,7 +62,7 @@ export default {
return !this.name || this.name.toLowerCase() === 'anonymus'
},
styles() {
let size = this.size
let size = this.sizeValue
if (Number.isInteger(Number(size))) {
size = `${size}px`
}
@ -73,6 +76,9 @@ export default {
color: this.fontColor
}
},
sizeValue() {
return tokens[`sizeAvatar${upperFirst(camelCase(this.size))}`]
},
hasImage() {
return Boolean(this.image) && !this.error
},