refactor: Use Node::from_padding helper

This commit is contained in:
demenik
2025-12-09 13:46:56 +01:00
parent e2b6e6ab0a
commit 11bd858fa8
2 changed files with 5 additions and 20 deletions

View File

@@ -44,28 +44,19 @@ fn setup(mut commands: Commands) {
button(
shop::components::ButtonType::ShopOpen,
ButtonVariant::Secondary,
Node {
padding: UiRect::all(px(10)),
..default()
},
Node::from_padding(UiRect::all(px(10))),
|color| text("Shop [P]", 16.0, color)
),
button(
inventory::components::ButtonType::InventoryOpen,
ButtonVariant::Secondary,
Node {
padding: UiRect::all(px(10)),
..default()
},
Node::from_padding(UiRect::all(px(10))),
|color| text("Inventar", 16.0, color)
),
button(
ButtonType::SettingsOpen,
ButtonVariant::Secondary,
Node {
padding: UiRect::all(px(10)),
..default()
},
Node::from_padding(UiRect::all(px(10))),
|color| text("Einstellungen", 16.0, color)
)
],

View File

@@ -70,10 +70,7 @@ pub fn open_context_menu(
action: option.clone(),
},
ButtonVariant::Primary,
Node {
padding: UiRect::all(px(5)),
..default()
},
Node::from_padding(UiRect::all(px(5))),
|c| text(option.clone().get_name(&game_config), 20.0, c), // TODO: add sprite
));
}
@@ -81,10 +78,7 @@ pub fn open_context_menu(
parent.spawn(button(
ButtonType::Cancel,
ButtonVariant::Destructive,
Node {
padding: UiRect::all(px(5)),
..default()
},
Node::from_padding(UiRect::all(px(5))),
|c| text("Abbrechen", 20.0, c),
));
},