2026-08-15 21:32:24 +03:00
|
|
|
use iced::Element;
|
2026-08-01 13:04:18 +03:00
|
|
|
use iced::border::Radius;
|
2026-08-04 14:09:40 +03:00
|
|
|
use iced::widget::button::*;
|
2026-08-01 17:23:43 +03:00
|
|
|
use iced::widget::{button, container};
|
|
|
|
|
use iced_core::Length::Fill;
|
2026-08-15 21:32:24 +03:00
|
|
|
use iced_core::alignment::Horizontal::Left;
|
2026-08-01 19:36:43 +03:00
|
|
|
use iced_core::{Border, Theme};
|
2026-08-01 13:04:18 +03:00
|
|
|
|
2026-08-04 14:09:40 +03:00
|
|
|
pub const HALF_SPACING: f32 = DEFAULT_SPACING / 2.0;
|
|
|
|
|
pub const QUARTER_SPACING: f32 = DEFAULT_SPACING / 4.0;
|
2026-08-01 13:04:18 +03:00
|
|
|
pub const DEFAULT_SPACING: f32 = 16.0;
|
|
|
|
|
pub const ACCENT_FONT_SIZE: f32 = 22.0;
|
2026-08-01 23:40:56 +03:00
|
|
|
pub const BUTTON_RADIUS: f32 = 8.0;
|
2026-08-01 13:04:18 +03:00
|
|
|
|
2026-08-04 16:53:09 +03:00
|
|
|
pub const SETTINGS_ICON: &[u8] = include_bytes!("../settings_icon.svg");
|
|
|
|
|
|
2026-08-01 13:04:18 +03:00
|
|
|
pub fn jl_button(theme: &Theme, status: Status) -> Style {
|
|
|
|
|
let mut style = primary(theme, status);
|
2026-08-01 19:36:43 +03:00
|
|
|
style.border = Border {
|
2026-08-01 13:04:18 +03:00
|
|
|
color: Default::default(),
|
|
|
|
|
width: 0.0,
|
|
|
|
|
radius: Radius::new(BUTTON_RADIUS),
|
|
|
|
|
};
|
|
|
|
|
style
|
2026-08-01 17:16:58 +03:00
|
|
|
}
|
2026-08-04 14:09:40 +03:00
|
|
|
pub fn cta_button(theme: &Theme, status: Status) -> Style {
|
|
|
|
|
let mut style = secondary(theme, status);
|
|
|
|
|
style.border.width = 1.0;
|
|
|
|
|
style.border.radius = Radius::new(BUTTON_RADIUS);
|
|
|
|
|
style
|
|
|
|
|
}
|
2026-08-01 17:16:58 +03:00
|
|
|
|
2026-08-01 17:23:43 +03:00
|
|
|
pub fn back_overlay<'a, T: Clone + 'a>(content: Element<'a, T>, back_message: T) -> Element<'a, T> {
|
|
|
|
|
container(
|
|
|
|
|
iced::widget::column![
|
2026-08-01 19:36:43 +03:00
|
|
|
button("Назад").style(jl_button).on_press(back_message),
|
2026-08-01 17:23:43 +03:00
|
|
|
content
|
2026-08-01 19:36:43 +03:00
|
|
|
]
|
2026-08-04 14:09:40 +03:00
|
|
|
.spacing(DEFAULT_SPACING)
|
2026-08-01 19:36:43 +03:00
|
|
|
.align_x(Left)
|
|
|
|
|
.width(Fill),
|
2026-08-01 17:23:43 +03:00
|
|
|
)
|
2026-08-01 19:36:43 +03:00
|
|
|
.center_x(Fill)
|
|
|
|
|
.padding(10)
|
|
|
|
|
.into()
|
|
|
|
|
}
|