🚚 Renombra add_component por add_child

This commit is contained in:
Manuel Cillero 2025-10-18 21:33:29 +02:00
parent c10f267fc6
commit 5fb9685594
12 changed files with 31 additions and 32 deletions

View file

@ -71,7 +71,7 @@ impl Block {
}
/// Añade un nuevo componente hijo al bloque.
pub fn add_component(mut self, component: impl Component) -> Self {
pub fn add_child(mut self, component: impl Component) -> Self {
self.children
.alter_child(ChildOp::Add(Child::with(component)));
self

View file

@ -65,10 +65,10 @@ pub enum IntroOpening {
/// ```rust
/// # use pagetop::prelude::*;
/// let intro = Intro::default()
/// .add_component(
/// .add_child(
/// Block::new()
/// .with_title(L10n::l("intro_custom_block_title"))
/// .add_component(Html::with(move |cx| {
/// .add_child(Html::with(move |cx| {
/// html! {
/// p { (L10n::l("intro_custom_paragraph_1").using(cx)) }
/// p { (L10n::l("intro_custom_paragraph_2").using(cx)) }
@ -301,7 +301,7 @@ impl Intro {
/// Añade un nuevo componente hijo a la intro.
///
/// Si es un bloque ([`Block`]) aplica estilos específicos para destacarlo.
pub fn add_component(mut self, component: impl Component) -> Self {
pub fn add_child(mut self, component: impl Component) -> Self {
self.children
.alter_child(ChildOp::Add(Child::with(component)));
self

View file

@ -26,22 +26,22 @@ async fn homepage(request: HttpRequest) -> ResultPage<Markup, ErrorPage> {
Page::new(request)
.with_title(L10n::l("welcome_title"))
.add_component(
.add_child(
Intro::new()
.add_component(
.add_child(
Block::new()
.with_title(L10n::l("welcome_status_title"))
.add_component(Html::with(move |cx| {
.add_child(Html::with(move |cx| {
html! {
p { (L10n::l("welcome_status_1").using(cx)) }
p { (L10n::l("welcome_status_2").using(cx)) }
}
})),
)
.add_component(
.add_child(
Block::new()
.with_title(L10n::l("welcome_support_title"))
.add_component(Html::with(move |cx| {
.add_child(Html::with(move |cx| {
html! {
p { (L10n::l("welcome_support_1").using(cx)) }
p { (L10n::l("welcome_support_2").with_arg("app", app).using(cx)) }