🚧 Doc & code tweaks

This commit is contained in:
Manuel Cillero 2024-07-27 19:19:18 +02:00
parent fea6c2f69e
commit c1e641723b
12 changed files with 79 additions and 53 deletions

View file

@ -44,7 +44,7 @@ impl<T: AssetsTrait> Assets<T> {
pub fn prepare(&mut self) -> Markup {
let assets = &mut self.0;
assets.sort_by_key(|a| a.weight());
assets.sort_by_key(AssetsTrait::weight);
html! {
@for a in assets {
(a.prepare())

View file

@ -61,12 +61,12 @@ impl StyleSheet {
}
#[rustfmt::skip]
pub fn for_media(mut self, media: TargetMedia) -> Self {
pub fn for_media(mut self, media: &TargetMedia) -> Self {
self.media = match media {
TargetMedia::Print => Some("print"),
TargetMedia::Screen => Some("screen"),
TargetMedia::Speech => Some("speech"),
_ => None,
TargetMedia::Default => None,
TargetMedia::Print => Some("print"),
TargetMedia::Screen => Some("screen"),
TargetMedia::Speech => Some("speech"),
};
self
}

View file

@ -37,9 +37,10 @@ impl<C: ComponentTrait> OptionComponent<C> {
}
pub fn render(&self, cx: &mut Context) -> Markup {
match &self.0 {
Some(component) => component.render(cx),
_ => html! {},
if let Some(component) = &self.0 {
component.render(cx)
} else {
html! {}
}
}
}