🚧 Working on layout
This commit is contained in:
parent
d99a5aa586
commit
0f65711d0e
10 changed files with 181 additions and 109 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use crate::base::component::Layout;
|
||||
use crate::core::component::{ComponentBase, ComponentTrait};
|
||||
use crate::base::component::*;
|
||||
use crate::core::component::{ComponentBase, ComponentClassesOp, ComponentTrait};
|
||||
use crate::core::package::PackageTrait;
|
||||
use crate::html::{html, Favicon, Markup};
|
||||
use crate::html::{html, ClassesOp, Favicon, Markup};
|
||||
use crate::locale::L10n;
|
||||
use crate::response::page::Page;
|
||||
use crate::{concat_string, config};
|
||||
|
|
@ -28,16 +28,49 @@ pub trait ThemeTrait: PackageTrait + Send + Sync {
|
|||
fn prepare_body(&self, page: &mut Page) -> Markup {
|
||||
let skip_to_id = concat_string!("#", page.skip_to().get().unwrap_or("content".to_owned()));
|
||||
|
||||
html! {
|
||||
body id=[page.body_id().get()] class=[page.body_classes().get()] {
|
||||
@if let Some(skip) = L10n::l("skip_to_content").using(page.context().langid()) {
|
||||
div class="skip__to_content" {
|
||||
a href=(skip_to_id) { (skip) }
|
||||
Container::body()
|
||||
.with_id(page.body_id().get().unwrap_or_default())
|
||||
.with_classes(ClassesOp::Add, page.body_classes().get().unwrap_or_default())
|
||||
.add_item(Flex::bundle()
|
||||
.add_component(Html::with(html! {
|
||||
@if let Some(skip) = L10n::l("skip_to_content").using(page.context().langid()) {
|
||||
div class="skip__to_content" {
|
||||
a href=(skip_to_id) { (skip) }
|
||||
}
|
||||
}
|
||||
}
|
||||
(Layout::new().render(page.context()))
|
||||
}
|
||||
}
|
||||
}))
|
||||
.add_component(Container::new()
|
||||
.with_id("body__wrapper")
|
||||
.with_direction(FlexDirection::Column(BreakPoint::None))
|
||||
.with_align(FlexAlign::Center)
|
||||
.add_item(Flex::with(Region::named("header")).with_id("header"))
|
||||
.add_item(Flex::with(Region::named("pagetop")).with_id("pagetop"))
|
||||
.add_item(
|
||||
Flex::with(
|
||||
Container::new()
|
||||
.with_direction(FlexDirection::Row(BreakPoint::None))
|
||||
.add_item(
|
||||
Flex::with(Region::named("sidebar_left"))
|
||||
.with_id("sidebar_left")
|
||||
.with_grow(FlexGrow::Is1),
|
||||
)
|
||||
.add_item(
|
||||
Flex::with(Region::named("content"))
|
||||
.with_id("content")
|
||||
.with_grow(FlexGrow::Is3),
|
||||
)
|
||||
.add_item(
|
||||
Flex::with(Region::named("sidebar_right"))
|
||||
.with_id("sidebar_right")
|
||||
.with_grow(FlexGrow::Is1),
|
||||
),
|
||||
)
|
||||
.with_id("flex__wrapper"),
|
||||
)
|
||||
.add_item(Flex::with(Region::named("footer")).with_id("footer")),
|
||||
)
|
||||
)
|
||||
.render(page.context())
|
||||
}
|
||||
|
||||
fn after_prepare_body(&self, page: &mut Page) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue