update
This commit is contained in:
parent
4a537cd933
commit
8208fa8899
20 changed files with 944 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
|||
use based::request::{RequestContext, StringResponse};
|
||||
use based::{
|
||||
get_pg,
|
||||
page::{Shell, render_page},
|
||||
ui::{Shell, render_page},
|
||||
};
|
||||
use maud::html;
|
||||
use rocket::get;
|
||||
|
|
42
examples/ui.rs
Normal file
42
examples/ui.rs
Normal file
|
@ -0,0 +1,42 @@
|
|||
use based::request::{RequestContext, StringResponse};
|
||||
use based::ui::{Shell, render_page};
|
||||
use maud::Render;
|
||||
use maud::html;
|
||||
use rocket::get;
|
||||
use rocket::routes;
|
||||
|
||||
use based::ui::appbar::AppBar;
|
||||
|
||||
#[get("/")]
|
||||
pub async fn index_page(ctx: RequestContext) -> StringResponse {
|
||||
let content = AppBar("MyApp", None).render();
|
||||
|
||||
let content = html!(
|
||||
h1 { "Hello World!" };
|
||||
|
||||
(content)
|
||||
|
||||
);
|
||||
|
||||
render_page(
|
||||
content,
|
||||
"Hello World",
|
||||
ctx,
|
||||
&Shell::new(
|
||||
html! {
|
||||
script src="https://cdn.tailwindcss.com" {};
|
||||
},
|
||||
html! {},
|
||||
Some(String::new()),
|
||||
),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
#[rocket::launch]
|
||||
async fn launch() -> _ {
|
||||
// Logging
|
||||
env_logger::init();
|
||||
|
||||
rocket::build().mount("/", routes![index_page])
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue