css(`
    tasks- {
        font-family: 'Bona';
    }

    tasks- input::placeholder {
        font-family: 'Bona Nova';
        font-size: 0.9em;
        color: var(--accent);
    }

    input[type="checkbox"] {
        appearance: none;        /* remove default style */
        -webkit-appearance: none;
        width: 1em;
        height: 1em;
        border: 1px solid var(--accent);
    }

    input[type="checkbox"]:checked {
        background-color: var(--red);
    }
`)

class Tasks extends Shadow {
    projects = [
        {
            "title": "Blockcatcher",
            "tasks": {}
        }
    ]
    columns = [
        {
            "title": "backlog",
            "tasks": {}
        }
    ]

    render() {
        ZStack(() => {
            HStack(() => {
                VStack(() => {
                    h3("Projects")
                        .marginTop(0)
                        .marginBottom(1, em)
                        .marginLeft(0.4, em)

                    if (this.projects.length >= 1) {
                        for(let i = 0; i < this.projects.length; i++) {
                            p(this.projects[i].title)
                        }
                    } else {
                        p("No Projects!")
                    }
                })
                .height(100, vh)
                .paddingLeft(2, em)
                .paddingRight(2, em)
                .paddingTop(2, em)
                .gap(0, em)
                .borderRight("0.5px solid var(--accent2)")

                HStack(() => {
                    if (this.columns.length >= 1) {
                        for(let i = 0; i < this.columns.length; i++) {
                            p(this.columns[i].name)
                        }
                    } else {
                        p("No Conversations!")
                    }
                })
                .height(100, vh)
                .paddingLeft(2, em)
                .paddingRight(2, em)
                .paddingTop(2, em)
                .gap(0, em)
                .borderRight("0.5px solid var(--accent2)")
            })
            .width(100, "%")
            .x(0).y(13, vh)
            .borderTop("0.5px solid var(--accent2)")

            p("0 Items")
                .position("absolute")
                .x(50, vw).y(50, vh)
                .transform("translate(-50%, -50%)")

            HStack(() => {
                input("Search tasks...", "45vw")
                    .attr({
                        "type": "text"
                    })
                    .fontSize(1.1, em)
                    .paddingLeft(1.3, em)
                    .background("transparent")
                    .border("0.5px solid var(--accent2)")
                    .outline("none")
                    .color("var(--accent)")
                    .borderRadius(10, px)

                button("Search")
                    .marginLeft(2, em)
                    .borderRadius(10, px)
                    .background("transparent")
                    .border("0.5px solid var(--accent2)")
                    .color("var(--accent)")
                    .fontFamily("Bona Nova")
                    .onHover(function (hovering) {
                        if(hovering) {
                            this.style.background = "var(--green)"

                        } else {
                            this.style.background = "transparent"

                        }
                    })

                button("+ New Task")
                    .width(9, em)
                    .marginLeft(1, em)
                    .borderRadius(10, px)
                    .background("transparent")
                    .border("0.5px solid var(--accent2)")
                    .color("var(--accent)")
                    .fontFamily("Bona Nova")
                    .onHover(function (hovering) {
                        if(hovering) {
                            this.style.background = "var(--green)"

                        } else {
                            this.style.background = "transparent"

                        }
                    })
                    .onClick((clicking) => {
                        console.log(this, "clicked")
                    })

            })
            .x(55, vw).y(4, vh)
            .position("absolute")
            .transform("translateX(-50%)")
        })
        .width(100, "%")
        .height(100, "%")
    }

    connectedCallback() {
        // Optional additional logic
    }
}

register(Tasks)