import { ListElement, ListItemElement } from "../base/component"; import { Location } from "./model"; export class WheatherLocationItem extends ListItemElement { getHref(value: Location): string { return `${value.provider}/${value.id}`; } getContent(value: Location): string { return ` ${value.provider} ${value.name} ${value.country}, ${value.district}, ${value.subdistrict} `; } } export class WeatherLocationList extends ListElement { childType = WheatherLocationItem; public onRefresh(): void { super.onRefresh(); if (!this.value?.length) { this.prepend("Empty"); } } } customElements.define("weather-location-item", WheatherLocationItem); customElements.define("weather-location-list", WeatherLocationList);