Skip to content

Commit

Permalink
feat(cxl-ui): cxl-base-card add lazyload for avatar image
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelkmpt committed Jan 30, 2024
1 parent e6cfa15 commit a53a92d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/cxl-ui/src/components/cxl-base-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export class CXLBaseCardElement extends LitElement {
@property({ type: Boolean, reflect: true, attribute: 'show-time-icon' }) showTimeIcon = false;
@property({ type: Boolean }) lazyload = true;
_slotHasChildren(e) {
const slot = e.target;
const { name } = slot;
Expand Down Expand Up @@ -76,7 +78,7 @@ export class CXLBaseCardElement extends LitElement {
}
_renderAvatar() {
return html`<img src=${this.avatar} alt="${this.instructor}" />`;
return html`<img src=${this.avatar} alt="${this.instructor}" loading="${this.lazyload ? 'lazy' : nothing}" />`;
}
/**
Expand Down

0 comments on commit a53a92d

Please sign in to comment.