🚧 Working on 0.1.0 version
This commit is contained in:
parent
9f62955acb
commit
41cedf2541
28 changed files with 3473 additions and 535 deletions
|
|
@ -12,229 +12,122 @@ impl PackageTrait for Welcome {
|
|||
}
|
||||
|
||||
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
|
||||
scfg.route("/", service::web::get().to(home_page))
|
||||
.route("/{lang}", service::web::get().to(home_lang));
|
||||
scfg.route("/", service::web::get().to(homepage));
|
||||
}
|
||||
}
|
||||
|
||||
async fn home_page(request: HttpRequest) -> ResultPage<Markup, ErrorPage> {
|
||||
home(request, &LANGID_DEFAULT)
|
||||
}
|
||||
|
||||
async fn home_lang(
|
||||
request: HttpRequest,
|
||||
path: service::web::Path<String>,
|
||||
) -> ResultPage<Markup, ErrorPage> {
|
||||
match langid_for(path.into_inner()) {
|
||||
Ok(lang) => home(request, lang),
|
||||
_ => Err(ErrorPage::NotFound(request)),
|
||||
}
|
||||
}
|
||||
|
||||
fn home(request: HttpRequest, lang: &'static LanguageIdentifier) -> ResultPage<Markup, ErrorPage> {
|
||||
async fn homepage(request: HttpRequest) -> ResultPage<Markup, ErrorPage> {
|
||||
Page::new(request)
|
||||
.with_title(L10n::l("welcome_title"))
|
||||
.with_assets(AssetsOp::LangId(lang))
|
||||
.with_assets(AssetsOp::AddStyleSheet(StyleSheet::from(
|
||||
"/base/css/welcome.css",
|
||||
)))
|
||||
.with_body_id("welcome")
|
||||
.with_component(hello_world())
|
||||
.with_component(welcome())
|
||||
.with_component(about_pagetop())
|
||||
.with_component(promo_pagetop())
|
||||
.with_component(reporting_issues())
|
||||
.with_title(L10n::l("welcome_page"))
|
||||
.with_assets(AssetsOp::Theme("Basic"))
|
||||
.with_assets(AssetsOp::AddStyleSheet(StyleSheet::inline("styles", r##"
|
||||
body {
|
||||
background-color: #f3d060;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 20px;
|
||||
}
|
||||
.skip__to_content {
|
||||
display: none;
|
||||
}
|
||||
.wrapper {
|
||||
max-width: 1200px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
}
|
||||
.container {
|
||||
padding: 0 16px;
|
||||
}
|
||||
.title {
|
||||
font-size: clamp(3rem, 10vw, 10rem);
|
||||
letter-spacing: -0.05em;
|
||||
line-height: 1.2;
|
||||
margin: 0;
|
||||
}
|
||||
.subtitle {
|
||||
font-size: clamp(1.8rem, 2vw, 3rem);
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1.2;
|
||||
margin: 0;
|
||||
}
|
||||
.powered {
|
||||
margin: .5em 0 1em;
|
||||
}
|
||||
.box-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: stretch;
|
||||
gap: 1.5em;
|
||||
}
|
||||
.box {
|
||||
flex: 1 1 280px;
|
||||
border: 3px solid #25282a;
|
||||
box-shadow: 5px 5px 0px #25282a;
|
||||
box-sizing: border-box;
|
||||
padding: 0 16px;
|
||||
}
|
||||
footer {
|
||||
margin-top: 5em;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #a5282c;
|
||||
}
|
||||
"##)))
|
||||
.with_component(Html::with(html! {
|
||||
div class="wrapper" {
|
||||
div class="container" {
|
||||
h1 class="title" { (L10n::l("welcome_title").markup()) }
|
||||
|
||||
p class="subtitle" {
|
||||
(L10n::l("welcome_intro").with_arg("app", format!(
|
||||
"<span style=\"font-weight: bold;\">{}</span>",
|
||||
&global::SETTINGS.app.name
|
||||
)).markup())
|
||||
}
|
||||
p class="powered" {
|
||||
(L10n::l("welcome_powered").with_arg("pagetop", format!(
|
||||
"<a href=\"{}\" target=\"_blank\">{}</a>",
|
||||
"https://crates.io/crates/pagetop", "PageTop"
|
||||
)).markup())
|
||||
}
|
||||
|
||||
h2 { (L10n::l("welcome_page").markup()) }
|
||||
|
||||
div class="box-container" {
|
||||
section class="box" style="background-color: #5eb0e5;" {
|
||||
h3 {
|
||||
(L10n::l("welcome_subtitle")
|
||||
.with_arg("app", &global::SETTINGS.app.name)
|
||||
.markup())
|
||||
}
|
||||
p { (L10n::l("welcome_text1").markup()) }
|
||||
p { (L10n::l("welcome_text2").markup()) }
|
||||
}
|
||||
section class="box" style="background-color: #aee1cd;" {
|
||||
h3 {
|
||||
(L10n::l("welcome_pagetop_title").markup())
|
||||
}
|
||||
p { (L10n::l("welcome_pagetop_text1").markup()) }
|
||||
p { (L10n::l("welcome_pagetop_text2").markup()) }
|
||||
p { (L10n::l("welcome_pagetop_text3").markup()) }
|
||||
}
|
||||
section class="box" style="background-color: #ebebe3;" {
|
||||
h3 {
|
||||
(L10n::l("welcome_issues_title").markup())
|
||||
}
|
||||
p { (L10n::l("welcome_issues_text1").markup()) }
|
||||
p {
|
||||
(L10n::l("welcome_issues_text2")
|
||||
.with_arg("app", &global::SETTINGS.app.name)
|
||||
.markup())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
footer { "[ " (L10n::l("welcome_have_fun").markup()) " ]" }
|
||||
}
|
||||
}
|
||||
}))
|
||||
.render()
|
||||
}
|
||||
|
||||
fn hello_world() -> flex::Container {
|
||||
flex::Container::header()
|
||||
.with_classes(ClassesOp::Add, "hello-world")
|
||||
.with_justify(flex::Justify::Center)
|
||||
.add_item(
|
||||
flex::Item::new()
|
||||
.with_size(flex::Size::Percent90)
|
||||
.add_component(
|
||||
flex::Container::new()
|
||||
.with_direction(flex::Direction::Column(BreakPoint::MD))
|
||||
.add_item(
|
||||
flex::Item::new()
|
||||
.with_classes(ClassesOp::Add, "hello-col-text")
|
||||
.with_size(flex::Size::Percent40)
|
||||
.add_component(
|
||||
Heading::h1(L10n::l("welcome_title"))
|
||||
.with_size(HeadingSize::Medium),
|
||||
)
|
||||
.add_component(
|
||||
Paragraph::fluent(L10n::l("welcome_intro").with_arg(
|
||||
"app",
|
||||
format!(
|
||||
"<span class=\"app-name\">{}</span>",
|
||||
&global::SETTINGS.app.name,
|
||||
),
|
||||
))
|
||||
.with_font_size(FontSize::Medium),
|
||||
)
|
||||
.add_component(Paragraph::fluent(
|
||||
L10n::l("welcome_powered").with_arg(
|
||||
"pagetop",
|
||||
format!(
|
||||
"<a href=\"{}\" target=\"_blank\">{}</a>",
|
||||
"https://pagetop.cillero.es", "PageTop",
|
||||
),
|
||||
),
|
||||
))
|
||||
.add_component(
|
||||
Button::anchor(
|
||||
"https://github.com/manuelcillero/pagetop",
|
||||
L10n::l("welcome_code"),
|
||||
)
|
||||
.with_target(ButtonTarget::Blank)
|
||||
.with_left_icon(Some(Icon::with("git")))
|
||||
.with_classes(ClassesOp::Add, "code-link")
|
||||
.with_font_size(FontSize::Medium),
|
||||
)
|
||||
.add_component(
|
||||
Button::anchor("#welcome-page", L10n::l("welcome"))
|
||||
.with_style(StyleBase::Link)
|
||||
.with_left_icon(Some(Icon::with("arrow-down-circle-fill")))
|
||||
.with_classes(ClassesOp::Add, "welcome-link")
|
||||
.with_font_size(FontSize::Medium),
|
||||
),
|
||||
)
|
||||
.add_item(
|
||||
flex::Item::with(Image::with("/base/images/header.svg"))
|
||||
.with_classes(ClassesOp::Add, "hello-col-image")
|
||||
.with_size(flex::Size::Percent60),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn welcome() -> flex::Container {
|
||||
flex::Container::section()
|
||||
.with_id("welcome-page")
|
||||
.with_classes(ClassesOp::Add, "welcome")
|
||||
.with_justify(flex::Justify::Center)
|
||||
.add_item(
|
||||
flex::Item::new()
|
||||
.with_size(flex::Size::Percent80)
|
||||
.add_component(Heading::h2(L10n::l("welcome_page")))
|
||||
.add_component(
|
||||
Heading::h3(L10n::l("welcome_subtitle").with_arg(
|
||||
"app",
|
||||
format!(
|
||||
"<span class=\"app-name\">{}</span>",
|
||||
&global::SETTINGS.app.name
|
||||
),
|
||||
))
|
||||
.with_size(HeadingSize::Subtitle),
|
||||
)
|
||||
.add_component(
|
||||
Paragraph::fluent(L10n::l("welcome_text1")).with_font_size(FontSize::Medium),
|
||||
)
|
||||
.add_component(Paragraph::fluent(L10n::l("welcome_text2"))),
|
||||
)
|
||||
}
|
||||
|
||||
fn about_pagetop() -> flex::Container {
|
||||
flex::Container::new()
|
||||
.with_classes(ClassesOp::Add, "pagetop")
|
||||
.with_justify(flex::Justify::Center)
|
||||
.add_item(
|
||||
flex::Item::new()
|
||||
.with_size(flex::Size::Percent90)
|
||||
.add_component(
|
||||
flex::Container::new()
|
||||
.with_direction(flex::Direction::Column(BreakPoint::SM))
|
||||
.add_item(
|
||||
flex::Item::with(Image::with("/base/images/about.svg"))
|
||||
.with_classes(ClassesOp::Add, "pagetop-col-image")
|
||||
.with_size(flex::Size::Percent40),
|
||||
)
|
||||
.add_item(
|
||||
flex::Item::new()
|
||||
.with_classes(ClassesOp::Add, "pagetop-col-text")
|
||||
.add_component(Heading::h2(L10n::l("welcome_pagetop_title")))
|
||||
.add_component(
|
||||
Paragraph::fluent(L10n::l("welcome_pagetop_text1"))
|
||||
.with_font_size(FontSize::Medium),
|
||||
)
|
||||
.add_component(Paragraph::fluent(L10n::l("welcome_pagetop_text2")))
|
||||
.add_component(Paragraph::fluent(L10n::l("welcome_pagetop_text3"))),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn promo_pagetop() -> flex::Container {
|
||||
flex::Container::new()
|
||||
.with_classes(ClassesOp::Add, "promo")
|
||||
.with_justify(flex::Justify::Center)
|
||||
.add_item(
|
||||
flex::Item::new()
|
||||
.with_size(flex::Size::Percent75)
|
||||
.add_component(
|
||||
flex::Container::new()
|
||||
.with_direction(flex::Direction::Column(BreakPoint::MD))
|
||||
.add_item(
|
||||
flex::Item::new()
|
||||
.with_classes(ClassesOp::Add, "promo-col-text")
|
||||
.with_size(flex::Size::Percent50)
|
||||
.add_component(Heading::h2(L10n::l("welcome_promo_title")))
|
||||
.add_component(
|
||||
Paragraph::fluent(L10n::l("welcome_promo_text1").with_arg(
|
||||
"pagetop",
|
||||
format!(
|
||||
"<a href=\"{}\" target=\"_blank\">{}</a>",
|
||||
"https://crates.io/crates/pagetop", "PageTop",
|
||||
),
|
||||
))
|
||||
.with_font_size(FontSize::Medium),
|
||||
),
|
||||
)
|
||||
.add_item(
|
||||
flex::Item::with(Image::with("/base/images/pagetop.png"))
|
||||
.with_classes(ClassesOp::Add, "promo-col-image")
|
||||
.with_size(flex::Size::Percent50),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn reporting_issues() -> flex::Container {
|
||||
flex::Container::new()
|
||||
.with_classes(ClassesOp::Add, "issues")
|
||||
.with_justify(flex::Justify::Center)
|
||||
.add_item(
|
||||
flex::Item::new()
|
||||
.with_size(flex::Size::Percent90)
|
||||
.add_component(
|
||||
flex::Container::new()
|
||||
.with_direction(flex::Direction::Column(BreakPoint::MD))
|
||||
.add_item(
|
||||
flex::Item::with(Image::with("/base/images/issues.jpg"))
|
||||
.with_classes(ClassesOp::Add, "issues-col-image"),
|
||||
)
|
||||
.add_item(
|
||||
flex::Item::new()
|
||||
.with_classes(ClassesOp::Add, "issues-col-text")
|
||||
.with_size(flex::Size::Percent50)
|
||||
.add_component(Heading::h2(L10n::l("welcome_issues_title")))
|
||||
.add_component(
|
||||
Paragraph::fluent(L10n::l("welcome_issues_text1"))
|
||||
.with_font_size(FontSize::Medium),
|
||||
)
|
||||
.add_component(Paragraph::fluent(
|
||||
L10n::l("welcome_issues_text2").with_arg(
|
||||
"app",
|
||||
format!(
|
||||
"<span class=\"app-name\">{}</span>",
|
||||
&global::SETTINGS.app.name,
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,30 +3,9 @@ use crate::prelude::*;
|
|||
pub struct Basic;
|
||||
|
||||
impl PackageTrait for Basic {
|
||||
fn name(&self) -> L10n {
|
||||
L10n::n("Basic")
|
||||
}
|
||||
|
||||
fn theme(&self) -> Option<ThemeRef> {
|
||||
Some(&Basic)
|
||||
}
|
||||
}
|
||||
|
||||
impl ThemeTrait for Basic {
|
||||
fn after_prepare_body(&self, page: &mut Page) {
|
||||
page.set_assets(AssetsOp::SetFavicon(Some(
|
||||
Favicon::new().with_icon("/base/favicon.ico"),
|
||||
)))
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::from("/base/css/normalize.min.css")
|
||||
.with_version("8.0.1")
|
||||
.with_weight(-90),
|
||||
))
|
||||
.set_assets(AssetsOp::AddBaseAssets)
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::from("/base/css/basic.css")
|
||||
.with_version("0.0.1")
|
||||
.with_weight(-90),
|
||||
));
|
||||
}
|
||||
}
|
||||
impl ThemeTrait for Basic {}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,7 @@ impl PackageTrait for Chassis {
|
|||
|
||||
impl ThemeTrait for Chassis {
|
||||
fn after_prepare_body(&self, page: &mut Page) {
|
||||
page.set_assets(AssetsOp::SetFavicon(Some(
|
||||
Favicon::new().with_icon("/base/favicon.ico"),
|
||||
)))
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
page.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::from("/base/css/normalize.min.css")
|
||||
.with_version("8.0.1")
|
||||
.with_weight(-90),
|
||||
|
|
|
|||
|
|
@ -14,10 +14,7 @@ impl PackageTrait for Inception {
|
|||
|
||||
impl ThemeTrait for Inception {
|
||||
fn after_prepare_body(&self, page: &mut Page) {
|
||||
page.set_assets(AssetsOp::SetFavicon(Some(
|
||||
Favicon::new().with_icon("/base/favicon.ico"),
|
||||
)))
|
||||
.set_assets(AssetsOp::AddStyleSheet(
|
||||
page.set_assets(AssetsOp::AddStyleSheet(
|
||||
StyleSheet::from("/base/css/normalize.min.css")
|
||||
.with_version("8.0.1")
|
||||
.with_weight(-90),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue