import "../components/NavBar.js"
import "../components/SignupForm.js"
import "./Why.js"
import "./Events.js"
import "./Join.js"
import "./SignIn.js"

class Home extends Shadow {
    render() {

        ZStack(() => {

            NavBar()

            img("_/icons/logo.svg", "2.5em")
                .onClick((done) => {
                    if(!done) return
                    window.navigateTo("/")
                })
                .position("absolute")
                .left(50, vw).top(4, em)
                .center()
                .transform(`translate(${window.isMobile() ? "-50%" : "-2em"}, -50%)`)
    
            switch(window.location.pathname) {
                case "/":
                    img("_/images/knight.png", "29vmax")
                        .position("absolute")
                        .left(50, vw).top(50, vh)
                        .center()
            
                    p("H &nbsp; Y &nbsp; P &nbsp; E &nbsp; R &nbsp; I &nbsp; A")
                        .x(50, vw).y(50, vh)
                        .center()
                        .color("var(--gold)")
                        .fontSize(5, vw)
            
                    p("A CLASSICAL CHRISTIAN ASSOCIATION")
                        .x(50, vw).yBottom(3, vh)
                        .center()
                        .letterSpacing(0.3, em)
                        .width(100, vw)
                        .textAlign("center")
                    break;
                case "/why":
                    Why()
                    break;
                case "/events":
                    Events()
                    break;
                case "/join":
                    Join()
                    break;
                case "/signin":
                    SignIn()
                    break;

                default:
                    if(window.location.pathname.startsWith("/signup")) {
                        SignupForm()
                    }
            }

        })
        .onNavigate(() => {
            this.rerender()
        })
            
    }
}

register(Home)