@ascua/gravatar 0.13.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,20 @@
1
1
  import Component from '@glimmer/component';
2
+ import { tracked } from '@glimmer/tracking';
3
+ import { action } from '@ember/object';
4
+ import { arg } from '@ascua/decorators';
2
5
  import avatar from '../utils/avatar';
3
6
  import md5 from "../utils/md5";
4
7
 
5
8
  export default class extends Component {
6
9
 
7
- get md5() {
8
- return md5(this.args.email);
9
- }
10
+ @tracked failed = null;
10
11
 
11
- get size() {
12
- return this.args.size || 80;
13
- }
12
+ @arg size = 80;
13
+
14
+ @arg gender = 'm';
14
15
 
15
- get gender() {
16
- return this.args.gender || 'm';
16
+ get md5() {
17
+ return md5(this.args.email);
17
18
  }
18
19
 
19
20
  get err() {
@@ -24,8 +25,12 @@ export default class extends Component {
24
25
  return `https://secure.gravatar.com/avatar/${this.md5}?s=${this.size}&d=404`;
25
26
  }
26
27
 
27
- get image() {
28
- return `url('${this.src}'), url('${this.err}')`;
28
+ get current() {
29
+ return this.failed === this.args.email ? this.err : this.src;
30
+ }
31
+
32
+ @action handleError() {
33
+ this.failed = this.args.email;
29
34
  }
30
35
 
31
36
  }
@@ -1,8 +1,13 @@
1
1
  app-gravatar {
2
2
  display:inline-block;
3
- background-size:cover;
3
+ }
4
+
5
+ app-gravatar img {
6
+ display:block;
7
+ object-fit:cover;
4
8
  }
5
9
 
6
10
  app-gravatar[circular] {
7
11
  border-radius:100%;
12
+ img { border-radius:100%; }
8
13
  }
@@ -1 +1,3 @@
1
- <app-gravatar {{style width=this.size height=this.size backgroundImage=this.image}} circular={{@circular}} ...attributes></app-gravatar>
1
+ <app-gravatar {{style width=this.size height=this.size}} circular={{@circular}} ...attributes>
2
+ <img src={{this.current}} width={{this.size}} height={{this.size}} {{on "error" this.handleError}} />
3
+ </app-gravatar>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ascua/gravatar",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "description": "Small description for @ascua/gravatar goes here",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -15,7 +15,7 @@
15
15
  "url": "https://surrealdb.com"
16
16
  },
17
17
  "dependencies": {
18
- "@ascua/modifiers": "^0.13.1",
18
+ "@ascua/modifiers": "^0.14.0",
19
19
  "ember-cli-babel": "^8.2.0",
20
20
  "ember-cli-htmlbars": "^6.3.0"
21
21
  },
@@ -26,5 +26,5 @@
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
- "gitHead": "b82210aa718b64830c1a2d503158cfbd30d06839"
29
+ "gitHead": "e9440da123a861e13175cbfa7947f129e5a69759"
30
30
  }