Migrate to tiny macros of button
This commit is contained in:
1 parent
444352c007
commit
1ad991667b
12 files changed
+52
-45
No files matched your search
+10
-3
@@ -1,7 +1,7 @@
|
||||
use iced::Element;
|
||||
use iced::border::Radius;
|
||||
use iced::widget::button::*;
|
||||
use iced::widget::{button, container};
|
||||
use iced::widget::container;
|
||||
use iced_core::Length::Fill;
|
||||
use iced_core::alignment::Horizontal::Left;
|
||||
use iced_core::{Border, Theme};
|
||||
@@ -14,7 +14,7 @@ pub const BUTTON_RADIUS: f32 = 8.0;
|
||||
|
||||
pub const SETTINGS_ICON: &[u8] = include_bytes!("../settings_icon.svg");
|
||||
|
||||
pub fn jl_button(theme: &Theme, status: Status) -> Style {
|
||||
pub fn jl_button_style(theme: &Theme, status: Status) -> Style {
|
||||
let mut style = primary(theme, status);
|
||||
style.border = Border {
|
||||
color: Default::default(),
|
||||
@@ -30,10 +30,17 @@ pub fn cta_button(theme: &Theme, status: Status) -> Style {
|
||||
style
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! jl_button {
|
||||
($content:expr) => {
|
||||
iced::widget::button($content).style($crate::styling::jl_button_style)
|
||||
};
|
||||
}
|
||||
|
||||
pub fn back_overlay<'a, T: Clone + 'a>(content: Element<'a, T>, back_message: T) -> Element<'a, T> {
|
||||
container(
|
||||
iced::widget::column![
|
||||
button("Назад").style(jl_button).on_press(back_message),
|
||||
jl_button!("Назад").on_press(back_message),
|
||||
content
|
||||
]
|
||||
.spacing(DEFAULT_SPACING)
|
||||
|
||||
Reference in new issue
Block a user