use dioxus::prelude::*;
use dioxus_router::{Route, Router};
use log::LevelFilter;

mod pages;
// use pages::{homepage, page_not_found};
use pages::{page_not_found, homepage};

mod components {
    pub mod nav;
}

fn main() {
    // Launch Dioxus web app
    dioxus_logger::init(LevelFilter::Trace).expect("failed to init logger");
    dioxus_web::launch(app);
}


// Our root component.
fn app(cx: Scope) -> Element {
    // Render "Hello, wasm!" to the screen.
    cx.render(rsx! {
        head { link {
            rel: "stylesheet",
            href: "https://unpkg.com/tailwindcss@^2.0/dist/tailwind.min.css"
        } }
        components::nav::nav {}
        Router { 
            Route { to: "/", pages::homepage {} }
            Route { to: "/login", pages::login {} }
            // Route { to: "/test", page_not_found{} }
            Route { to: "/orange", "Oranges are not apples!" }
            Route { to: "", pages::page_not_found {} }
        }
    })
}

