Added date selector popup (only go to now working)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
.dates{
|
||||
.date-indicator{
|
||||
height: 30px;
|
||||
|
||||
/* For text alignement */
|
||||
@ -6,7 +6,7 @@
|
||||
vertical-align: middle;
|
||||
line-height: 30px;
|
||||
|
||||
cursor: default;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
class DatesIndicator extends HTMLElement{
|
||||
constructor(timestamp){
|
||||
class DateIndicator extends HTMLElement{
|
||||
constructor(timestamp, goToNowCallback, jumpCallback){
|
||||
super();
|
||||
this.formattedDate = this.timestampToString(timestamp);
|
||||
this.datePopup = new DatesPopup(goToNowCallback, jumpCallback);
|
||||
}
|
||||
|
||||
dayNumberToName(dayNumber){
|
||||
@ -35,21 +36,28 @@ class DatesIndicator extends HTMLElement{
|
||||
|
||||
update(timestamp){
|
||||
this.formattedDate = this.timestampToString(timestamp);
|
||||
this.render()
|
||||
this.getElementsByClassName("date-indicator")[0].textContent = this.formattedDate;
|
||||
}
|
||||
|
||||
showPopup(){
|
||||
console.log("clicked");
|
||||
this.datePopup.show();
|
||||
}
|
||||
|
||||
connectedCallback(){
|
||||
this.render();
|
||||
this.getElementsByClassName("date-indicator")[0].onclick = () => {this.showPopup();};
|
||||
}
|
||||
|
||||
render(){
|
||||
this.innerHTML = `
|
||||
<link rel="stylesheet" href="components/states_indicator/dates/dates.css">
|
||||
<div class="dates">
|
||||
<div class="date-indicator">
|
||||
${this.formattedDate}
|
||||
</div>
|
||||
`
|
||||
`
|
||||
this.appendChild(this.datePopup);
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("sea-dates-indicator", DatesIndicator)
|
||||
customElements.define("sea-date-indicator", DateIndicator)
|
Reference in New Issue
Block a user