This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e8b228
commit 3cb18ca
Showing
15 changed files
with
280 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
export class CommentsContainerComponent extends HTMLElement { | ||
constructor() { | ||
super(); | ||
this.comments = []; | ||
} | ||
|
||
static get observedAttributes() { | ||
return []; | ||
} | ||
|
||
attributeChangedCallback(name, oldValue, newValue) { | ||
|
||
} | ||
|
||
connectedCallback() { | ||
this.slug = this.getAttribute('slug'); | ||
fetch('https://conduit.productionready.io/api/articles/' + this.slug + '/comments').then((response) => { | ||
return response.json(); | ||
}).then(r => { | ||
this.comments = r.comments; | ||
this.innerHTML = this.render(); | ||
}); | ||
} | ||
|
||
disconnectedCallback() { | ||
|
||
} | ||
|
||
render() { | ||
return ` | ||
${this.comments.map(comment => { | ||
return ` | ||
<comment-preview | ||
username="${comment.author.username}" | ||
content="${comment.body}"> | ||
</comment-preview> | ||
`; | ||
}).join(' ')} | ||
`; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.