Files
seweb/client/components/action_entry/action_entry.js
2024-08-23 15:29:14 +02:00

28 lines
773 B
JavaScript

class ActionEntry extends HTMLElement{
constructor(title, actionCallback){
super();
this.title = title;
this.actionCallback = actionCallback;
}
performActionCallback(){
this.actionCallback()
}
connectedCallback(){
this.render();
this.getElementsByTagName("img")[0].onclick = () => {this.performActionCallback();};
}
render(){
this.innerHTML = `
<link rel="stylesheet" href="components/action_entry/action_entry.css">
<div class="action-entry">
<span class="action-entry-title">${this.title}</span>
<img src="res/arrow.png" class="action-entry-arrow">
</div>
`;
}
}
customElements.define("sea-action-entry", ActionEntry);