Skip to content

Commit

Permalink
Allow custom font sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
darrynten committed Oct 4, 2019
1 parent 3e8ad05 commit 79b12dc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@unicorns/avatars",
"description": "Easy avatars or initials",
"version": "2.0.1",
"version": "2.0.2",
"author": "Unicorn Global et al",
"private": false,
"license": "MIT",
Expand Down
6 changes: 5 additions & 1 deletion src/AvatarOrInitials.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export default {
required: false,
default: 40
},
fontSize: {
required: false,
default: 20
},
round: {
type: Boolean,
required: false,
Expand Down Expand Up @@ -137,7 +141,7 @@ export default {
return this.title.charAt(0)
},
initialsStyle() {
return `width: ${this.size}px; height: ${this.size}px; border-radius: ${this.size }px; background-color: ${this.bgColour()}; text-transform: uppercase; color: ${this.textColour()}; display: flex; justify-content: center; align-items: center;`
return `width: ${this.size}px; font-size: ${this.fontSize}px; height: ${this.size}px; border-radius: ${this.size }px; background-color: ${this.bgColour()}; text-transform: uppercase; color: ${this.textColour()}; display: flex; justify-content: center; align-items: center;`
},
radius() {
if (this.round) {
Expand Down
2 changes: 1 addition & 1 deletion test/AvatarOrInitials.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('AvatarOrInitials.vue', () => {
}
})

expect(avatarOrInitials.vm.initialsStyle).toBe('width: 50px; height: 50px; border-radius: 50px; background-color: #cddc39; text-transform: uppercase; color: #000000; display: flex; justify-content: center; align-items: center;');
expect(avatarOrInitials.vm.initialsStyle).toBe('width: 50px; font-size: 20px; height: 50px; border-radius: 50px; background-color: #cddc39; text-transform: uppercase; color: #000000; display: flex; justify-content: center; align-items: center;');
expect(avatarOrInitials.find('.initials').text()).toBe('a')
expect(avatarOrInitials.vm.radius).toBe(undefined);
})
Expand Down

0 comments on commit 79b12dc

Please sign in to comment.