chore: scaffold Rantii project with README, icons, CSS, and JS directory structure
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @fileoverview Home Page Component for Rantii
|
||||
* @author retoor <retoor@molodetz.nl>
|
||||
* @description Main feed page displaying latest rants
|
||||
* @keywords home, page, feed, main, landing
|
||||
*/
|
||||
|
||||
import { BaseComponent } from '../components/base-component.js';
|
||||
|
||||
class HomePage extends BaseComponent {
|
||||
static get observedAttributes() {
|
||||
return ['sort'];
|
||||
}
|
||||
|
||||
init() {
|
||||
this.render();
|
||||
}
|
||||
|
||||
render() {
|
||||
const sort = this.getAttr('sort') || 'recent';
|
||||
|
||||
this.addClass('page', 'home-page');
|
||||
|
||||
this.setHtml(`
|
||||
<rant-feed sort="${sort}" feed-type="rants"></rant-feed>
|
||||
`);
|
||||
}
|
||||
|
||||
onAttributeChanged(name, oldValue, newValue) {
|
||||
if (name === 'sort') {
|
||||
const feed = this.$('rant-feed');
|
||||
if (feed) {
|
||||
feed.setSort(newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
refresh() {
|
||||
const feed = this.$('rant-feed');
|
||||
if (feed) {
|
||||
feed.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('home-page', HomePage);
|
||||
|
||||
export { HomePage };
|
||||
Reference in New Issue
Block a user