@justeattakeaway/pie-avatar 0.1.0 → 0.2.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.
@@ -11,8 +11,42 @@
11
11
  {
12
12
  "kind": "javascript-module",
13
13
  "path": "src/defs.js",
14
- "declarations": [],
15
- "exports": []
14
+ "declarations": [
15
+ {
16
+ "kind": "variable",
17
+ "name": "tags",
18
+ "type": {
19
+ "text": "['a', 'button', 'div']"
20
+ },
21
+ "default": "['a', 'button', 'div']"
22
+ },
23
+ {
24
+ "kind": "variable",
25
+ "name": "defaultProps",
26
+ "type": {
27
+ "text": "DefaultProps"
28
+ },
29
+ "default": "{\n tag: 'div',\n}"
30
+ }
31
+ ],
32
+ "exports": [
33
+ {
34
+ "kind": "js",
35
+ "name": "tags",
36
+ "declaration": {
37
+ "name": "tags",
38
+ "module": "src/defs.js"
39
+ }
40
+ },
41
+ {
42
+ "kind": "js",
43
+ "name": "defaultProps",
44
+ "declaration": {
45
+ "name": "defaultProps",
46
+ "module": "src/defs.js"
47
+ }
48
+ }
49
+ ]
16
50
  },
17
51
  {
18
52
  "kind": "javascript-module",
@@ -22,7 +56,99 @@
22
56
  "kind": "class",
23
57
  "description": "",
24
58
  "name": "PieAvatar",
25
- "members": [],
59
+ "members": [
60
+ {
61
+ "kind": "field",
62
+ "name": "tag",
63
+ "privacy": "public"
64
+ },
65
+ {
66
+ "kind": "field",
67
+ "name": "label",
68
+ "type": {
69
+ "text": "AvatarProps['label']"
70
+ },
71
+ "privacy": "public"
72
+ },
73
+ {
74
+ "kind": "method",
75
+ "name": "getInitials",
76
+ "privacy": "private",
77
+ "return": {
78
+ "type": {
79
+ "text": "Initials | null"
80
+ }
81
+ },
82
+ "parameters": [
83
+ {
84
+ "name": "name",
85
+ "type": {
86
+ "text": "string"
87
+ }
88
+ }
89
+ ],
90
+ "description": "Attempts to extract initials from the label string.\nIf the label is not provided or is invalid, it returns null."
91
+ },
92
+ {
93
+ "kind": "method",
94
+ "name": "renderInitials",
95
+ "privacy": "private",
96
+ "return": {
97
+ "type": {
98
+ "text": "TemplateResult"
99
+ }
100
+ },
101
+ "parameters": [
102
+ {
103
+ "name": "initials",
104
+ "type": {
105
+ "text": "Initials"
106
+ }
107
+ }
108
+ ],
109
+ "description": "Renders the initials both for visual display and for screen readers."
110
+ },
111
+ {
112
+ "kind": "method",
113
+ "name": "renderIcon",
114
+ "privacy": "private",
115
+ "return": {
116
+ "type": {
117
+ "text": "TemplateResult"
118
+ }
119
+ },
120
+ "description": "Renders the icon (placeholder span for now)."
121
+ },
122
+ {
123
+ "kind": "field",
124
+ "name": "avatarContent",
125
+ "type": {
126
+ "text": "TemplateResult"
127
+ },
128
+ "privacy": "private",
129
+ "description": "Renders the inner content of the avatar such as initials, an icon or an image.\nIt is a getter because the value is computed based on properties",
130
+ "readonly": true
131
+ },
132
+ {
133
+ "kind": "method",
134
+ "name": "renderAvatarWrapper",
135
+ "privacy": "private",
136
+ "return": {
137
+ "type": {
138
+ "text": "TemplateResult"
139
+ }
140
+ },
141
+ "parameters": [
142
+ {
143
+ "name": "content",
144
+ "type": {
145
+ "text": "TemplateResult"
146
+ }
147
+ }
148
+ ],
149
+ "description": "Renders the avatar wrapper element based on the `tag` property.\nCan be a `button`, `a` or a `div`."
150
+ }
151
+ ],
26
152
  "mixins": [
27
153
  {
28
154
  "name": "RtlMixin",
package/dist/index.d.ts CHANGED
@@ -1,20 +1,72 @@
1
- import type { CSSResult } from 'lit';
2
- import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
1
+ import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
2
+ import { CSSResult } from 'lit';
3
+ import { GenericConstructor } from '@justeattakeaway/pie-webc-core';
3
4
  import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
4
- import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
5
- import type { TemplateResult } from 'lit-html';
5
+ import { RTLInterface } from '@justeattakeaway/pie-webc-core';
6
+ import { TemplateResult } from 'lit';
6
7
 
7
8
  export declare interface AvatarProps {
9
+ label?: string;
10
+ /**
11
+ * Label for the username that will be turned into initials inside the avatar, if provided.
12
+ */
13
+ tag: typeof tags[number];
8
14
  }
9
15
 
16
+ export declare type DefaultProps = ComponentDefaultProps<AvatarProps, keyof Omit<AvatarProps, 'label'>>;
17
+
18
+ export declare const defaultProps: DefaultProps;
19
+
20
+ export declare type Initials = {
21
+ visual: string;
22
+ screenreader: string;
23
+ };
24
+
10
25
  /**
11
26
  * @tagname pie-avatar
12
27
  */
13
28
  export declare class PieAvatar extends PieAvatar_base implements AvatarProps {
14
- render(): TemplateResult<1>;
29
+ tag: "a" | "button" | "div";
30
+ label: AvatarProps['label'];
31
+ /**
32
+ * Attempts to extract initials from the label string.
33
+ * If the label is not provided or is invalid, it returns null.
34
+ *
35
+ * @private
36
+ */
37
+ private getInitials;
38
+ /**
39
+ * Renders the initials both for visual display and for screen readers.
40
+ *
41
+ * @private
42
+ */
43
+ private renderInitials;
44
+ /**
45
+ * Renders the icon (placeholder span for now).
46
+ *
47
+ * @private
48
+ */
49
+ private renderIcon;
50
+ /**
51
+ * Renders the inner content of the avatar such as initials, an icon or an image.
52
+ * It is a getter because the value is computed based on properties
53
+ *
54
+ * @private
55
+ */
56
+ private get avatarContent();
57
+ /**
58
+ * Renders the avatar wrapper element based on the `tag` property.
59
+ * Can be a `button`, `a` or a `div`.
60
+ *
61
+ * @private
62
+ */
63
+ private renderAvatarWrapper;
64
+ render(): TemplateResult;
15
65
  static styles: CSSResult;
16
66
  }
17
67
 
18
68
  declare const PieAvatar_base: GenericConstructor<RTLInterface> & typeof PieElement;
19
69
 
70
+ export declare const tags: readonly ["a", "button", "div"];
71
+
20
72
  export { }
package/dist/index.js CHANGED
@@ -1,27 +1,106 @@
1
- import { LitElement as p, html as f, unsafeCSS as h } from "lit";
2
- import { RtlMixin as c, safeCustomElement as d } from "@justeattakeaway/pie-webc-core";
3
- const e = class e extends p {
1
+ import { LitElement as h, html as n, unsafeCSS as f } from "lit";
2
+ import { RtlMixin as g, validPropertyValues as b, safeCustomElement as y } from "@justeattakeaway/pie-webc-core";
3
+ import { property as v } from "lit/decorators.js";
4
+ const o = class o extends h {
4
5
  willUpdate() {
5
- this.getAttribute("v") || this.setAttribute("v", e.v);
6
+ this.getAttribute("v") || this.setAttribute("v", o.v);
6
7
  }
7
8
  };
8
- e.v = "0.1.0";
9
- let s = e;
10
- const u = "*,*:after,*:before{box-sizing:inherit}:host{display:block}";
11
- var b = Object.getOwnPropertyDescriptor, m = (i, l, v, o) => {
12
- for (var t = o > 1 ? void 0 : o ? b(l, v) : l, r = i.length - 1, n; r >= 0; r--)
13
- (n = i[r]) && (t = n(t) || t);
14
- return t;
9
+ o.v = "0.2.0";
10
+ let d = o;
11
+ const m = "*,*:after,*:before{box-sizing:inherit}:host{display:block}.c-avatar-visuallyHidden{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap}.c-avatar-content{display:flex;justify-content:center;align-items:center;font-size:calc(var(--dt-font-body-s-size) * 1px);background-color:var(--dt-color-container-inverse);color:var(--dt-color-content-interactive-primary);width:32px;height:32px;border-radius:var(--dt-radius-rounded-e)}.c-avatar-placeholder{display:inline-block;text-align:center;font-size:6px}", x = ["a", "button", "div"], u = {
12
+ tag: "div"
15
13
  };
16
- let a = class extends c(s) {
14
+ var w = Object.defineProperty, I = Object.getOwnPropertyDescriptor, c = (t, e, a, i) => {
15
+ for (var r = i > 1 ? void 0 : i ? I(e, a) : e, l = t.length - 1, p; l >= 0; l--)
16
+ (p = t[l]) && (r = (i ? p(e, a, r) : p(r)) || r);
17
+ return i && r && w(e, a, r), r;
18
+ };
19
+ const S = "pie-avatar";
20
+ let s = class extends g(d) {
21
+ constructor() {
22
+ super(...arguments), this.tag = u.tag;
23
+ }
24
+ /**
25
+ * Attempts to extract initials from the label string.
26
+ * If the label is not provided or is invalid, it returns null.
27
+ *
28
+ * @private
29
+ */
30
+ getInitials(t) {
31
+ try {
32
+ if (!t || typeof t != "string" || t.trim().length === 0)
33
+ return null;
34
+ const a = t.trim().replace(/-/g, " ").split(/\s+/).slice(0, 2).map((i) => i[0].toUpperCase());
35
+ return a.length === 0 ? null : {
36
+ visual: a.join(""),
37
+ screenreader: a.join(", ")
38
+ // joins the two words by comma so initials are correctly pronounced by screenreaders
39
+ };
40
+ } catch {
41
+ return null;
42
+ }
43
+ }
44
+ /**
45
+ * Renders the initials both for visual display and for screen readers.
46
+ *
47
+ * @private
48
+ */
49
+ renderInitials(t) {
50
+ return n`
51
+ <span aria-hidden="true" data-test-id="pie-avatar-initials-visual">${t.visual}</span>
52
+ <span class="c-avatar-visuallyHidden" data-test-id="pie-avatar-initials-screenreader">${t.screenreader}</span>
53
+ `;
54
+ }
55
+ /**
56
+ * Renders the icon (placeholder span for now).
57
+ *
58
+ * @private
59
+ */
60
+ renderIcon() {
61
+ return n`<span data-test-id="pie-avatar-icon" class="c-avatar-placeholder">Icon Placeholder</span>`;
62
+ }
63
+ /**
64
+ * Renders the inner content of the avatar such as initials, an icon or an image.
65
+ * It is a getter because the value is computed based on properties
66
+ *
67
+ * @private
68
+ */
69
+ get avatarContent() {
70
+ if (this.label) {
71
+ const t = this.getInitials(this.label);
72
+ if (t)
73
+ return this.renderInitials(t);
74
+ }
75
+ return this.renderIcon();
76
+ }
77
+ /**
78
+ * Renders the avatar wrapper element based on the `tag` property.
79
+ * Can be a `button`, `a` or a `div`.
80
+ *
81
+ * @private
82
+ */
83
+ renderAvatarWrapper(t) {
84
+ const { tag: e } = this;
85
+ return e === "button" ? n`<button data-test-id="pie-avatar-button">${t}</button>` : e === "a" ? n`<a data-test-id="pie-avatar-anchor">${t}</a>` : n`<div class="c-avatar-content" data-test-id="pie-avatar-div">${t}</div>`;
86
+ }
17
87
  render() {
18
- return f`<h1 data-test-id="pie-avatar">Hello world!</h1>`;
88
+ return this.renderAvatarWrapper(this.avatarContent);
19
89
  }
20
90
  };
21
- a.styles = h(u);
22
- a = m([
23
- d("pie-avatar")
24
- ], a);
91
+ s.styles = f(m);
92
+ c([
93
+ v({ type: String }),
94
+ b(S, x, u.tag)
95
+ ], s.prototype, "tag", 2);
96
+ c([
97
+ v({ type: String })
98
+ ], s.prototype, "label", 2);
99
+ s = c([
100
+ y("pie-avatar")
101
+ ], s);
25
102
  export {
26
- a as PieAvatar
103
+ s as PieAvatar,
104
+ u as defaultProps,
105
+ x as tags
27
106
  };
package/dist/react.d.ts CHANGED
@@ -1,20 +1,70 @@
1
- import type { CSSResult } from 'lit';
2
- import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
1
+ import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
2
+ import { CSSResult } from 'lit';
3
+ import { GenericConstructor } from '@justeattakeaway/pie-webc-core';
3
4
  import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
4
5
  import * as React_2 from 'react';
5
- import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
6
- import type { TemplateResult } from 'lit-html';
6
+ import { RTLInterface } from '@justeattakeaway/pie-webc-core';
7
+ import { TemplateResult } from 'lit';
7
8
 
8
9
  export declare interface AvatarProps {
10
+ label?: string;
11
+ /**
12
+ * Label for the username that will be turned into initials inside the avatar, if provided.
13
+ */
14
+ tag: typeof tags[number];
9
15
  }
10
16
 
11
- export declare const PieAvatar: React_2.ForwardRefExoticComponent<AvatarProps & React_2.RefAttributes<PieAvatar_2> & ReactBaseType>;
17
+ export declare type DefaultProps = ComponentDefaultProps<AvatarProps, keyof Omit<AvatarProps, 'label'>>;
18
+
19
+ export declare const defaultProps: DefaultProps;
20
+
21
+ export declare type Initials = {
22
+ visual: string;
23
+ screenreader: string;
24
+ };
25
+
26
+ export declare const PieAvatar: React_2.ForwardRefExoticComponent<React_2.PropsWithoutRef<AvatarProps> & React_2.RefAttributes<PieAvatar_2> & ReactBaseType>;
12
27
 
13
28
  /**
14
29
  * @tagname pie-avatar
15
30
  */
16
31
  declare class PieAvatar_2 extends PieAvatar_base implements AvatarProps {
17
- render(): TemplateResult<1>;
32
+ tag: "a" | "button" | "div";
33
+ label: AvatarProps['label'];
34
+ /**
35
+ * Attempts to extract initials from the label string.
36
+ * If the label is not provided or is invalid, it returns null.
37
+ *
38
+ * @private
39
+ */
40
+ private getInitials;
41
+ /**
42
+ * Renders the initials both for visual display and for screen readers.
43
+ *
44
+ * @private
45
+ */
46
+ private renderInitials;
47
+ /**
48
+ * Renders the icon (placeholder span for now).
49
+ *
50
+ * @private
51
+ */
52
+ private renderIcon;
53
+ /**
54
+ * Renders the inner content of the avatar such as initials, an icon or an image.
55
+ * It is a getter because the value is computed based on properties
56
+ *
57
+ * @private
58
+ */
59
+ private get avatarContent();
60
+ /**
61
+ * Renders the avatar wrapper element based on the `tag` property.
62
+ * Can be a `button`, `a` or a `div`.
63
+ *
64
+ * @private
65
+ */
66
+ private renderAvatarWrapper;
67
+ render(): TemplateResult;
18
68
  static styles: CSSResult;
19
69
  }
20
70
 
@@ -22,4 +72,6 @@ declare const PieAvatar_base: GenericConstructor<RTLInterface> & typeof PieEleme
22
72
 
23
73
  declare type ReactBaseType = React_2.HTMLAttributes<HTMLElement>;
24
74
 
75
+ export declare const tags: readonly ["a", "button", "div"];
76
+
25
77
  export { }
package/dist/react.js CHANGED
@@ -1,13 +1,16 @@
1
1
  import * as a from "react";
2
- import { createComponent as e } from "@lit/react";
3
- import { PieAvatar as t } from "./index.js";
4
- const r = e({
2
+ import { createComponent as t } from "@lit/react";
3
+ import { PieAvatar as e } from "./index.js";
4
+ import { defaultProps as v, tags as c } from "./index.js";
5
+ const r = t({
5
6
  displayName: "PieAvatar",
6
- elementClass: t,
7
+ elementClass: e,
7
8
  react: a,
8
9
  tagName: "pie-avatar",
9
10
  events: {}
10
- }), m = r;
11
+ }), i = r;
11
12
  export {
12
- m as PieAvatar
13
+ i as PieAvatar,
14
+ v as defaultProps,
15
+ c as tags
13
16
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-avatar",
3
3
  "description": "PIE Design System Avatar built using Web Components",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -33,13 +33,13 @@
33
33
  "license": "Apache-2.0",
34
34
  "devDependencies": {
35
35
  "@custom-elements-manifest/analyzer": "0.9.0",
36
- "@justeattakeaway/pie-components-config": "0.20.1",
37
- "@justeattakeaway/pie-css": "0.17.0",
38
- "@justeattakeaway/pie-monorepo-utils": "0.5.1",
36
+ "@justeattakeaway/pie-components-config": "0.21.0",
37
+ "@justeattakeaway/pie-css": "0.19.0",
38
+ "@justeattakeaway/pie-monorepo-utils": "0.7.0",
39
39
  "cem-plugin-module-file-extensions": "0.0.5"
40
40
  },
41
41
  "dependencies": {
42
- "@justeattakeaway/pie-webc-core": "1.0.0"
42
+ "@justeattakeaway/pie-webc-core": "1.1.0"
43
43
  },
44
44
  "volta": {
45
45
  "extends": "../../../package.json"
package/src/avatar.scss CHANGED
@@ -5,3 +5,27 @@
5
5
  // "block" or "inline-block", otherwise it can be ommited for floating elements
6
6
  display: block;
7
7
  }
8
+
9
+ .c-avatar-visuallyHidden {
10
+ @include p.visually-hidden;
11
+ }
12
+
13
+ .c-avatar-content {
14
+ display: flex;
15
+ justify-content: center;
16
+ align-items: center;
17
+ @include p.font-size(--dt-font-body-s-size);
18
+ background-color: var(--dt-color-container-inverse);
19
+ color: var(--dt-color-content-interactive-primary);
20
+ width: 32px;
21
+ height: 32px;
22
+ border-radius:var(--dt-radius-rounded-e);
23
+
24
+ }
25
+
26
+ // Basic placeholder styling - will be removed in subsequent ticket
27
+ .c-avatar-placeholder {
28
+ display: inline-block;
29
+ text-align: center;
30
+ font-size: 6px;
31
+ }
package/src/defs.ts CHANGED
@@ -1,3 +1,25 @@
1
- // TODO - please remove the eslint disable comment below when you add props to this interface
2
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
3
- export interface AvatarProps {}
1
+ import { type ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
2
+
3
+ export const tags = ['a', 'button', 'div'] as const;
4
+
5
+ export interface AvatarProps {
6
+ label?: string;
7
+ /**
8
+ * Label for the username that will be turned into initials inside the avatar, if provided.
9
+ */
10
+ tag: typeof tags[number];
11
+ /**
12
+ * What HTML element the avatar should be such as button, a or div.
13
+ */
14
+
15
+ }
16
+
17
+ export type DefaultProps = ComponentDefaultProps<AvatarProps, keyof Omit<AvatarProps, 'label'>>;
18
+ export const defaultProps: DefaultProps = {
19
+ tag: 'div',
20
+ };
21
+
22
+ export type Initials = {
23
+ visual: string,
24
+ screenreader: string
25
+ }
package/src/index.ts CHANGED
@@ -1,9 +1,14 @@
1
- import { html, unsafeCSS } from 'lit';
1
+ import {
2
+ html, type TemplateResult, unsafeCSS,
3
+ } from 'lit';
2
4
  import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
3
- import { RtlMixin, safeCustomElement } from '@justeattakeaway/pie-webc-core';
5
+ import { RtlMixin, safeCustomElement, validPropertyValues } from '@justeattakeaway/pie-webc-core';
4
6
 
7
+ import { property } from 'lit/decorators.js';
5
8
  import styles from './avatar.scss?inline';
6
- import { type AvatarProps } from './defs';
9
+ import {
10
+ type AvatarProps, defaultProps, tags, type Initials,
11
+ } from './defs';
7
12
 
8
13
  // Valid values available to consumers
9
14
  export * from './defs';
@@ -15,8 +20,103 @@ const componentSelector = 'pie-avatar';
15
20
  */
16
21
  @safeCustomElement('pie-avatar')
17
22
  export class PieAvatar extends RtlMixin(PieElement) implements AvatarProps {
23
+ @property({ type: String })
24
+ @validPropertyValues(componentSelector, tags, defaultProps.tag)
25
+ public tag = defaultProps.tag;
26
+
27
+ @property({ type: String })
28
+ public label: AvatarProps['label'];
29
+
30
+ /**
31
+ * Attempts to extract initials from the label string.
32
+ * If the label is not provided or is invalid, it returns null.
33
+ *
34
+ * @private
35
+ */
36
+ private getInitials (name: string): Initials | null {
37
+ try {
38
+ if (!name || typeof name !== 'string' || name.trim().length === 0) {
39
+ return null;
40
+ }
41
+
42
+ const nameSplit: string[] = name.trim().replace(/-/g, ' ').split(/\s+/); // [Ada, Lovelace]
43
+ const initials: string[] = nameSplit.slice(0, 2).map((word) => word[0].toUpperCase()); // [A, L]
44
+
45
+ if (initials.length === 0) {
46
+ return null;
47
+ }
48
+
49
+ return {
50
+ visual: initials.join(''),
51
+ screenreader: initials.join(', '), // joins the two words by comma so initials are correctly pronounced by screenreaders
52
+ };
53
+ } catch (error) {
54
+ return null;
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Renders the initials both for visual display and for screen readers.
60
+ *
61
+ * @private
62
+ */
63
+ private renderInitials (initials: Initials): TemplateResult {
64
+ return html`
65
+ <span aria-hidden="true" data-test-id="pie-avatar-initials-visual">${initials.visual}</span>
66
+ <span class="c-avatar-visuallyHidden" data-test-id="pie-avatar-initials-screenreader">${initials.screenreader}</span>
67
+ `;
68
+ }
69
+
70
+ /**
71
+ * Renders the icon (placeholder span for now).
72
+ *
73
+ * @private
74
+ */
75
+ private renderIcon (): TemplateResult {
76
+ return html`<span data-test-id="pie-avatar-icon" class="c-avatar-placeholder">Icon Placeholder</span>`;
77
+ }
78
+
79
+ /**
80
+ * Renders the inner content of the avatar such as initials, an icon or an image.
81
+ * It is a getter because the value is computed based on properties
82
+ *
83
+ * @private
84
+ */
85
+ private get avatarContent (): TemplateResult {
86
+ // TODO: handle unauthenticated and src here
87
+
88
+ if (this.label) {
89
+ const initials = this.getInitials(this.label);
90
+ if (initials) {
91
+ return this.renderInitials(initials);
92
+ }
93
+ }
94
+
95
+ return this.renderIcon();
96
+ }
97
+
98
+ /**
99
+ * Renders the avatar wrapper element based on the `tag` property.
100
+ * Can be a `button`, `a` or a `div`.
101
+ *
102
+ * @private
103
+ */
104
+ private renderAvatarWrapper (content: TemplateResult): TemplateResult {
105
+ const { tag } = this;
106
+
107
+ if (tag === 'button') {
108
+ return html`<button data-test-id="pie-avatar-button">${content}</button>`;
109
+ }
110
+
111
+ if (tag === 'a') {
112
+ return html`<a data-test-id="pie-avatar-anchor">${content}</a>`;
113
+ }
114
+
115
+ return html`<div class="c-avatar-content" data-test-id="pie-avatar-div">${content}</div>`;
116
+ }
117
+
18
118
  render () {
19
- return html`<h1 data-test-id="pie-avatar">Hello world!</h1>`;
119
+ return this.renderAvatarWrapper(this.avatarContent);
20
120
  }
21
121
 
22
122
  // Renders a `CSSResult` generated from SCSS by Vite