♻️ (pagetop): with_prop() acepta impl Into<PropsOp>
`FlexItem`, `Margin` y `Padding` se pasan directamente gracias a `From` hacia `PropsOp`, sin `PropsOp::flex_item()`/`margin()`/`padding()` ni `.into()` explícito. Revisadas todas las llamadas en el código para simplificarlas.
This commit is contained in:
parent
50e4b42fe4
commit
3c3ffc91e6
49 changed files with 141 additions and 165 deletions
|
|
@ -217,9 +217,9 @@ fn align_self_block() -> Block {
|
|||
.with_gap(flex::Gap::Both(UnitValue::RelRem(0.5))),
|
||||
)
|
||||
.with_child(sized_box(Lc::t("flex_box_tall", &LOC), "2.5rem 1rem"))
|
||||
.with_child(demo_box(flex_item("1")).with_prop(PropsOp::flex_item(
|
||||
FlexItem::new().with_align_self(align_self),
|
||||
)))
|
||||
.with_child(
|
||||
demo_box(flex_item("1")).with_prop(FlexItem::new().with_align_self(align_self)),
|
||||
)
|
||||
.with_child(sized_box(Lc::t("flex_box_tall", &LOC), "2.5rem 1rem")),
|
||||
);
|
||||
}
|
||||
|
|
@ -238,9 +238,10 @@ fn align_self_block() -> Block {
|
|||
sized_box(Lc::t("flex_box_tall", &LOC), "2.5rem 1rem")
|
||||
.with_prop(PropsOp::add_style("font-size", "1.75rem")),
|
||||
)
|
||||
.with_child(demo_box(flex_item("1")).with_prop(PropsOp::flex_item(
|
||||
FlexItem::new().with_align_self(flex::ItemAlign::Baseline),
|
||||
)))
|
||||
.with_child(
|
||||
demo_box(flex_item("1"))
|
||||
.with_prop(FlexItem::new().with_align_self(flex::ItemAlign::Baseline)),
|
||||
)
|
||||
.with_child(sized_box(Lc::t("flex_box_tall", &LOC), "2.5rem 1rem")),
|
||||
)
|
||||
}
|
||||
|
|
@ -318,9 +319,8 @@ fn grow_shrink_block() -> Block {
|
|||
demo_row(Flex::new().with_gap(flex::Gap::Both(UnitValue::RelRem(0.5))))
|
||||
.with_child(demo_box(Lc::t("flex_box_fixed", &LOC)))
|
||||
.with_child(
|
||||
demo_box(Lc::t("flex_box_grows", &LOC)).with_prop(PropsOp::flex_item(
|
||||
FlexItem::new().with_grow(flex::ItemGrow::Is1),
|
||||
)),
|
||||
demo_box(Lc::t("flex_box_grows", &LOC))
|
||||
.with_prop(FlexItem::new().with_grow(flex::ItemGrow::Is1)),
|
||||
)
|
||||
.with_child(demo_box(Lc::t("flex_box_fixed", &LOC))),
|
||||
)
|
||||
|
|
@ -337,9 +337,7 @@ fn grow_shrink_block() -> Block {
|
|||
.with_child(
|
||||
demo_box(flex_item("2"))
|
||||
.with_prop(PropsOp::add_style("width", "10.5rem"))
|
||||
.with_prop(PropsOp::flex_item(
|
||||
FlexItem::new().with_shrink(flex::ItemShrink::Is0),
|
||||
)),
|
||||
.with_prop(FlexItem::new().with_shrink(flex::ItemShrink::Is0)),
|
||||
)
|
||||
.with_child(
|
||||
demo_box(flex_item("3")).with_prop(PropsOp::add_style("width", "10.5rem")),
|
||||
|
|
@ -359,9 +357,7 @@ fn other_block() -> Block {
|
|||
demo_row(Flex::new().with_gap(flex::Gap::Both(UnitValue::RelRem(0.5))))
|
||||
.with_child(demo_box(Lc::t("flex_box_start_1", &LOC)))
|
||||
.with_child(demo_box(Lc::t("flex_box_start_2", &LOC)))
|
||||
.with_child(
|
||||
demo_box(Lc::t("flex_box_end", &LOC)).with_prop(FlexItem::push_end().into()),
|
||||
),
|
||||
.with_child(demo_box(Lc::t("flex_box_end", &LOC)).with_prop(FlexItem::push_end())),
|
||||
);
|
||||
|
||||
let mut wrap_row = demo_row(
|
||||
|
|
@ -394,15 +390,17 @@ fn other_block() -> Block {
|
|||
))
|
||||
.with_child(
|
||||
demo_row(Flex::new().with_gap(flex::Gap::Both(UnitValue::RelRem(0.5))))
|
||||
.with_child(demo_box(Lc::n("A")).with_prop(PropsOp::flex_item(
|
||||
FlexItem::new().with_order(flex::ItemOrder::Last),
|
||||
)))
|
||||
.with_child(
|
||||
demo_box(Lc::n("A"))
|
||||
.with_prop(FlexItem::new().with_order(flex::ItemOrder::Last)),
|
||||
)
|
||||
.with_child(demo_box(Lc::n("B")))
|
||||
.with_child(demo_box(Lc::n("C")))
|
||||
.with_child(demo_box(Lc::n("D")))
|
||||
.with_child(demo_box(Lc::n("E")).with_prop(PropsOp::flex_item(
|
||||
FlexItem::new().with_order(flex::ItemOrder::First),
|
||||
))),
|
||||
.with_child(
|
||||
demo_box(Lc::n("E"))
|
||||
.with_prop(FlexItem::new().with_order(flex::ItemOrder::First)),
|
||||
),
|
||||
)
|
||||
.with_child(caption(
|
||||
Lc::t("flex_title_gap_none", &LOC),
|
||||
|
|
@ -430,15 +428,18 @@ fn other_block() -> Block {
|
|||
))
|
||||
.with_child(
|
||||
demo_row(Flex::new())
|
||||
.with_child(demo_box(Lc::n("1/3")).with_prop(PropsOp::flex_item(
|
||||
FlexItem::new().with_size(flex::ItemSize::Percent33),
|
||||
)))
|
||||
.with_child(demo_box(Lc::n("1/3")).with_prop(PropsOp::flex_item(
|
||||
FlexItem::new().with_size(flex::ItemSize::Percent33),
|
||||
)))
|
||||
.with_child(demo_box(Lc::n("1/3")).with_prop(PropsOp::flex_item(
|
||||
FlexItem::new().with_size(flex::ItemSize::Percent33),
|
||||
))),
|
||||
.with_child(
|
||||
demo_box(Lc::n("1/3"))
|
||||
.with_prop(FlexItem::new().with_size(flex::ItemSize::Percent33)),
|
||||
)
|
||||
.with_child(
|
||||
demo_box(Lc::n("1/3"))
|
||||
.with_prop(FlexItem::new().with_size(flex::ItemSize::Percent33)),
|
||||
)
|
||||
.with_child(
|
||||
demo_box(Lc::n("1/3"))
|
||||
.with_prop(FlexItem::new().with_size(flex::ItemSize::Percent33)),
|
||||
),
|
||||
)
|
||||
.with_child(caption(
|
||||
Lc::t("flex_title_grid_offset", &LOC),
|
||||
|
|
@ -450,11 +451,11 @@ fn other_block() -> Block {
|
|||
))
|
||||
.with_child(
|
||||
demo_row(Flex::new()).with_child(
|
||||
demo_box(Lc::t("flex_box_half_centered", &LOC)).with_prop(PropsOp::flex_item(
|
||||
demo_box(Lc::t("flex_box_half_centered", &LOC)).with_prop(
|
||||
FlexItem::new()
|
||||
.with_size(flex::ItemSize::Percent50)
|
||||
.with_offset(flex::ItemOffset::Percent25),
|
||||
)),
|
||||
),
|
||||
),
|
||||
)
|
||||
.with_child(caption(
|
||||
|
|
@ -470,9 +471,7 @@ fn other_block() -> Block {
|
|||
.with_child(demo_box(Lc::t("flex_box_file", &LOC)))
|
||||
.with_child(demo_box(Lc::t("flex_box_edit", &LOC)))
|
||||
.with_child(demo_box(Lc::t("flex_box_view", &LOC)))
|
||||
.with_child(
|
||||
demo_box(Lc::t("flex_box_profile", &LOC)).with_prop(FlexItem::push_end().into()),
|
||||
)
|
||||
.with_child(demo_box(Lc::t("flex_box_profile", &LOC)).with_prop(FlexItem::push_end()))
|
||||
.with_child(demo_box(Lc::t("flex_box_logout", &LOC))),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,12 +92,12 @@ fn grid_block() -> Block {
|
|||
row = row.with_child(
|
||||
Container::new()
|
||||
.with_prop(PropsOp::add_style("padding", "0.25rem"))
|
||||
.with_prop(PropsOp::flex_item(
|
||||
.with_prop(
|
||||
FlexItem::new()
|
||||
.with_size(flex::ItemSize::Percent100)
|
||||
.with_size_at(Breakpoint::Sm, flex::ItemSize::Percent50)
|
||||
.with_size_at(Breakpoint::Md, flex::ItemSize::Percent33),
|
||||
))
|
||||
)
|
||||
.with_child(demo_box(card_label(n))),
|
||||
);
|
||||
}
|
||||
|
|
@ -154,9 +154,7 @@ fn order_block() -> Block {
|
|||
demo_row(Flex::at(Breakpoint::Lg).with_gap(flex::Gap::Both(UnitValue::RelRem(0.5))))
|
||||
.with_child(demo_box(Lc::t("responsive_box_content", &LOC)))
|
||||
.with_child(demo_box(Lc::t("responsive_box_sidebar", &LOC)).with_prop(
|
||||
PropsOp::flex_item(
|
||||
FlexItem::new().with_order_at(Breakpoint::Lg, flex::ItemOrder::First),
|
||||
),
|
||||
FlexItem::new().with_order_at(Breakpoint::Lg, flex::ItemOrder::First),
|
||||
)),
|
||||
)
|
||||
}
|
||||
|
|
@ -181,11 +179,10 @@ fn gap_grow_block() -> Block {
|
|||
)
|
||||
.with_child(demo_box(Lc::t("responsive_box_file", &LOC)))
|
||||
.with_child(demo_box(Lc::t("responsive_box_edit", &LOC)))
|
||||
.with_child(demo_box(Lc::t("responsive_box_search", &LOC)).with_prop(
|
||||
PropsOp::flex_item(
|
||||
FlexItem::new().with_grow_at(Breakpoint::Md, flex::ItemGrow::Is1),
|
||||
),
|
||||
)),
|
||||
.with_child(
|
||||
demo_box(Lc::t("responsive_box_search", &LOC))
|
||||
.with_prop(FlexItem::new().with_grow_at(Breakpoint::Md, flex::ItemGrow::Is1)),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,9 +66,8 @@ fn padding_block() -> Block {
|
|||
block = block
|
||||
.with_child(caption(Lc::t(title_key, &LOC), Lc::n(code)))
|
||||
.with_child(
|
||||
demo_row(Flex::new().with_gap(flex::Gap::Both(UnitValue::RelRem(0.5)))).with_child(
|
||||
demo_box(box_sample()).with_prop(Padding::new().with_all(size).into()),
|
||||
),
|
||||
demo_row(Flex::new().with_gap(flex::Gap::Both(UnitValue::RelRem(0.5))))
|
||||
.with_child(demo_box(box_sample()).with_prop(Padding::new().with_all(size))),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -90,8 +89,7 @@ fn padding_block() -> Block {
|
|||
.with_top(UnitValue::RelRem(0.25))
|
||||
.with_end(UnitValue::RelRem(2.5))
|
||||
.with_bottom(UnitValue::RelRem(1.5))
|
||||
.with_start(UnitValue::RelRem(0.5))
|
||||
.into(),
|
||||
.with_start(UnitValue::RelRem(0.5)),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
@ -108,8 +106,7 @@ fn layout_block() -> Block {
|
|||
demo_row(Flex::new())
|
||||
.with_child(demo_box(box_sample()))
|
||||
.with_child(
|
||||
demo_box(box_sample())
|
||||
.with_prop(Margin::new().with_x(UnitValue::RelRem(1.0)).into()),
|
||||
demo_box(box_sample()).with_prop(Margin::new().with_x(UnitValue::RelRem(1.0))),
|
||||
)
|
||||
.with_child(demo_box(box_sample())),
|
||||
)
|
||||
|
|
@ -120,10 +117,10 @@ fn layout_block() -> Block {
|
|||
.with_child(
|
||||
demo_row(Flex::new()).with_child(
|
||||
demo_box(box_sample())
|
||||
.with_prop(Margin::new().with_x(UnitValue::Auto).into())
|
||||
.with_prop(PropsOp::flex_item(
|
||||
.with_prop(Margin::new().with_x(UnitValue::Auto))
|
||||
.with_prop(
|
||||
FlexItem::new().with_size(flex::ItemSize::Custom(UnitValue::RelRem(8.0))),
|
||||
)),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -146,8 +143,7 @@ fn responsive_block() -> Block {
|
|||
Padding::new()
|
||||
.with_all(UnitValue::RelRem(0.5))
|
||||
.with_all_at(Breakpoint::Md, UnitValue::RelRem(2.0))
|
||||
.with_all_at(Breakpoint::Lg, UnitValue::RelRem(4.0))
|
||||
.into(),
|
||||
.with_all_at(Breakpoint::Lg, UnitValue::RelRem(4.0)),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
@ -160,16 +156,16 @@ fn combined_block() -> Block {
|
|||
Lc::t("spacing_title_combined", &LOC),
|
||||
Lc::n(concat!(
|
||||
"Container::new()",
|
||||
".with_prop(Margin::new().with_y(UnitValue::RelRem(1.0)).into())",
|
||||
".with_prop(Padding::new().with_all(UnitValue::RelRem(1.5)).into())",
|
||||
".with_prop(Margin::new().with_y(UnitValue::RelRem(1.0)))",
|
||||
".with_prop(Padding::new().with_all(UnitValue::RelRem(1.5)))",
|
||||
)),
|
||||
))
|
||||
.with_child(
|
||||
demo_row(Flex::new()).with_child(
|
||||
Container::new()
|
||||
.with_prop(PropsOp::add_classes("spacing-demo-box"))
|
||||
.with_prop(Margin::new().with_y(UnitValue::RelRem(1.0)).into())
|
||||
.with_prop(Padding::new().with_all(UnitValue::RelRem(1.5)).into())
|
||||
.with_prop(Margin::new().with_y(UnitValue::RelRem(1.0)))
|
||||
.with_prop(Padding::new().with_all(UnitValue::RelRem(1.5)))
|
||||
.with_child(
|
||||
Button::plain(Lc::t("spacing_box_card_button", &LOC))
|
||||
.with_style(button::Style::Solid(Intent::Warning)),
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ impl Extension for SuperMenu {
|
|||
.with_item(bs::navbar::Item::nav(
|
||||
bs::Nav::new()
|
||||
// Empuja este menú (y lo que le siga) al extremo final de la barra.
|
||||
.with_prop(FlexItem::push_end().into())
|
||||
.with_prop(FlexItem::push_end())
|
||||
.with_item(bs::nav::Item::link(
|
||||
Lc::t("menus_item_sign_up", &LOC),
|
||||
"/auth/sign-up",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue