♻️ (pagetop): Incorpora Context al render de Props
This commit is contained in:
parent
a2b3ae2eb8
commit
ab1d4f0efb
49 changed files with 212 additions and 133 deletions
|
|
@ -27,7 +27,7 @@ pub(crate) async fn render(dialog: &Dialog, cx: &mut Context) -> Result<Markup,
|
|||
|
||||
Ok(html! {
|
||||
div
|
||||
(dialog.props())
|
||||
(dialog.props().unpack(cx))
|
||||
tabindex="-1"
|
||||
aria-hidden="true"
|
||||
aria-labelledby=[id_label.as_deref()]
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ pub(crate) async fn render(
|
|||
if title.is_empty() {
|
||||
// Sin título: menú contextual estático, sin botón ni comportamiento de apertura/cierre.
|
||||
return Ok(html! {
|
||||
div (dropdown.props()) {
|
||||
div (dropdown.props().unpack(cx)) {
|
||||
ul class="dropdown-menu" { (items) }
|
||||
}
|
||||
});
|
||||
|
|
@ -173,7 +173,7 @@ pub(crate) async fn render(
|
|||
};
|
||||
|
||||
Ok(html! {
|
||||
div (dropdown.props()) {
|
||||
div (dropdown.props().unpack(cx)) {
|
||||
// Renderizado en modo split (dos botones) o simple (un botón).
|
||||
@if *dropdown.button_split() {
|
||||
// Botón principal (acción/etiqueta).
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ pub(crate) fn render(field: &Field, cx: &mut Context) -> Result<Markup, Componen
|
|||
};
|
||||
|
||||
Ok(html! {
|
||||
div (field.props()) {
|
||||
div (field.props().unpack(cx)) {
|
||||
@if !floating { (label) }
|
||||
input
|
||||
type=(field.kind())
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ pub(crate) fn render(field: &Field, cx: &mut Context) -> Result<Markup, Componen
|
|||
None => html! {},
|
||||
};
|
||||
Ok(html! {
|
||||
div (field.props()) {
|
||||
div (field.props().unpack(cx)) {
|
||||
@if !floating { (label) }
|
||||
select
|
||||
id=[select_id.as_deref()]
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ pub(crate) fn render(field: &Textarea, cx: &mut Context) -> Result<Markup, Compo
|
|||
None => html! {},
|
||||
};
|
||||
Ok(html! {
|
||||
div (field.props()) {
|
||||
div (field.props().unpack(cx)) {
|
||||
@if !floating { (label) }
|
||||
textarea
|
||||
id=[textarea_id.as_deref()]
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ impl Component for Icon {
|
|||
let has_label = aria_label.is_some();
|
||||
html! {
|
||||
i
|
||||
(self.props())
|
||||
(self.props().unpack(cx))
|
||||
role=[has_label.then_some("img")]
|
||||
aria-label=[aria_label]
|
||||
aria-hidden=[(!has_label).then_some("true")]
|
||||
|
|
@ -65,7 +65,7 @@ impl Component for Icon {
|
|||
viewBox=(viewbox)
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
(self.props())
|
||||
(self.props().unpack(cx))
|
||||
role=[has_label.then_some("img")]
|
||||
aria-label=[aria_label]
|
||||
aria-hidden=[(!has_label).then_some("true")]
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ pub(crate) async fn item_render(item: &Item, cx: &mut Context) -> Result<Markup,
|
|||
ItemKind::Void => html! {},
|
||||
|
||||
ItemKind::Label(label) => html! {
|
||||
li (item.props()) {
|
||||
li (item.props().unpack(cx)) {
|
||||
span class="nav-link disabled" aria-disabled="true" {
|
||||
(label.using(cx))
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ pub(crate) async fn item_render(item: &Item, cx: &mut Context) -> Result<Markup,
|
|||
let aria_disabled = (*disabled).then_some("true");
|
||||
|
||||
html! {
|
||||
li (item.props()) {
|
||||
li (item.props().unpack(cx)) {
|
||||
a
|
||||
class=(classes)
|
||||
href=[href]
|
||||
|
|
@ -153,7 +153,7 @@ pub(crate) async fn item_render(item: &Item, cx: &mut Context) -> Result<Markup,
|
|||
}
|
||||
|
||||
ItemKind::Html(html) => html! {
|
||||
li (item.props()) {
|
||||
li (item.props().unpack(cx)) {
|
||||
(html.render(cx).await)
|
||||
}
|
||||
},
|
||||
|
|
@ -170,7 +170,7 @@ pub(crate) async fn item_render(item: &Item, cx: &mut Context) -> Result<Markup,
|
|||
.unwrap_or_else(|| "Dropdown".to_string())
|
||||
});
|
||||
html! {
|
||||
li (item.props()) {
|
||||
li (item.props().unpack(cx)) {
|
||||
a
|
||||
class="nav-link dropdown-toggle"
|
||||
data-bs-toggle="dropdown"
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ pub(crate) async fn render(navbar: &Navbar, cx: &mut Context) -> Result<Markup,
|
|||
.unwrap_or_else(|_| translate_layout(navbar.layout()));
|
||||
|
||||
Ok(html! {
|
||||
nav (navbar.props()) {
|
||||
nav (navbar.props().unpack(cx)) {
|
||||
div class="container-fluid" {
|
||||
@match layout {
|
||||
// Barra más sencilla: sólo contenido.
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ impl Offcanvas {
|
|||
|
||||
html! {
|
||||
div
|
||||
(self.props())
|
||||
(self.props().unpack(cx))
|
||||
tabindex="-1"
|
||||
data-bs-scroll=[body_scroll]
|
||||
data-bs-backdrop=[backdrop]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue