Initial port to svelte
This commit is contained in:
parent
410cba70e5
commit
0dee6d64ed
21 changed files with 333 additions and 424 deletions
37
vnshed/src/lib/components/img_button.svelte
Normal file
37
vnshed/src/lib/components/img_button.svelte
Normal file
|
@ -0,0 +1,37 @@
|
|||
<!-- class ImgButton {
|
||||
|
||||
html = undefined;
|
||||
id = undefined;
|
||||
|
||||
constructor(name, img) {
|
||||
this.html = document.createElement('div');
|
||||
this.html.classList.add("imgbutton");
|
||||
this.id = makeid(8);
|
||||
this.html.id = this.id;
|
||||
|
||||
let btn_img = document.createElement('img');
|
||||
btn_img.src = img;
|
||||
btn_img.innerHTML = name;
|
||||
this.html.appendChild(btn_img);
|
||||
}
|
||||
|
||||
addHadler(func) {
|
||||
this.html.addEventListener("click", func);
|
||||
return this;
|
||||
}
|
||||
|
||||
setCssClass(name) {
|
||||
this.html.classList.add(name);
|
||||
}
|
||||
|
||||
} -->
|
||||
|
||||
<script>
|
||||
import { makeid } from "$lib/functions.js"
|
||||
let id = makeid(8);
|
||||
let { style, image, name } = $props();
|
||||
</script>
|
||||
|
||||
<div class="imgbutton {style}">
|
||||
<img src={image} alt={name}>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue