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( button(
shop::components::ButtonType::ShopOpen, shop::components::ButtonType::ShopOpen,
ButtonVariant::Secondary, ButtonVariant::Secondary,
Node { Node::from_padding(UiRect::all(px(10))),
padding: UiRect::all(px(10)),
..default()
},
|color| text("Shop [P]", 16.0, color) |color| text("Shop [P]", 16.0, color)
), ),
button( button(
inventory::components::ButtonType::InventoryOpen, inventory::components::ButtonType::InventoryOpen,
ButtonVariant::Secondary, ButtonVariant::Secondary,
Node { Node::from_padding(UiRect::all(px(10))),
padding: UiRect::all(px(10)),
..default()
},
|color| text("Inventar", 16.0, color) |color| text("Inventar", 16.0, color)
), ),
button( button(
ButtonType::SettingsOpen, ButtonType::SettingsOpen,
ButtonVariant::Secondary, ButtonVariant::Secondary,
Node { Node::from_padding(UiRect::all(px(10))),
padding: UiRect::all(px(10)),
..default()
},
|color| text("Einstellungen", 16.0, color) |color| text("Einstellungen", 16.0, color)
) )
], ],

View File

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