blob: d65328cc8da8b9a6bd43439d02625fe1bd46674a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
use iced::Element;
use crate::gui::components::{active_button, inactive_button};
use super::{Message, Navigation};
impl<'a, TOption> Navigation<TOption>
where
TOption: Clone + PartialEq + 'a,
Element<'a, Message<TOption>>: From<&'a TOption>,
{
pub(super) fn view_navigation_button(
&'a self,
option: &'a TOption,
) -> Element<'a, Message<TOption>> {
if self
.active_option
.as_ref()
.is_some_and(|o| TOption::eq(o, option))
{
active_button(option)
} else {
inactive_button(option, Message::SelectOption(option.clone()))
}
.into()
}
}
|