import './ForumPanel.js'

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

    forum- 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 Forum extends Shadow {

    selectedForum = "HY"

    render() {
        ZStack(() => {
            VStack(() => {

                ForumPanel()

                input("Message Hyperia", "98%")
                    .paddingVertical(1, em)
                    .paddingLeft(2, pct)
                    .color("var(--accent)")
                    .background("var(--darkbrown)")
                    .marginBottom(6, em)
                    .border("none")
                    .fontSize(1, em)
                    .onKeyDown(function (e) {
                        if (e.key === "Enter") {
                            window.Socket.send({app: "FORUM", operation: "SEND", msg: {forum: "HY", text: this.value }})
                            this.value = ""
                        }
                    })
            })
            .gap(0.5, em)
            .width(100, pct)
            .height(100, vh)
            .horizontalAlign("center")
            .verticalAlign("end")
        })
        .onAppear(() => document.body.style.backgroundColor = "var(--darkbrown)")
        .width(100, pct)
        .height(100, pct)
    }

    
}

register(Forum)