import { IgniteElement } from './ignite-element.js';
import { IgniteTemplate, div, html, list, a } from './ignite-template.js';

class Sheet extends IgniteElement {
    constructor() {
        super();

        this.show = false;
        this.items = [];
        this.href = "www.google.com";
        this.name = "default content";
    }

    get properties() {
        return [
            "show",
            "name",
            "items",
            "href"
        ];
    }

    render() {
        return this.template
            .class(this.show)
            .child(
                new div(
                    new html("<h2>this is before</h2>"),
                    new list(this.items, (item) => {
                        return new a(this.name).attribute("href", this.href)
                    }),
                    new html("<h2>this is after</h2>")
                )
            );
    }
}

class SheetTemplate extends IgniteTemplate {
    constructor(...items) {
        super(items);

        this.tagName = "md-sheet";
    }
}

customElements.define("md-sheet", Sheet);

export { SheetTemplate as Sheet };