Skip to content

Commit 4dbecc8

Browse files
authored
Rename Tabs to Tab for clarity in the tab argument closures and in the method signature for tab_button (#593)
1 parent b9bcd24 commit 4dbecc8

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

examples/layout/src/tab_navigation.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ use floem::{
99
};
1010

1111
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
12-
enum Tabs {
12+
enum Tab {
1313
General,
1414
Settings,
1515
Feedback,
1616
}
1717

18-
impl std::fmt::Display for Tabs {
18+
impl std::fmt::Display for Tab {
1919
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2020
match *self {
21-
Tabs::General => write!(f, "General"),
22-
Tabs::Settings => write!(f, "Settings"),
23-
Tabs::Feedback => write!(f, "Feedback"),
21+
Tab::General => write!(f, "General"),
22+
Tab::Settings => write!(f, "Settings"),
23+
Tab::Feedback => write!(f, "Feedback"),
2424
}
2525
}
2626
}
2727

2828
fn tab_button(
29-
this_tab: Tabs,
30-
tabs: ReadSignal<im::Vector<Tabs>>,
29+
this_tab: Tab,
30+
tabs: ReadSignal<im::Vector<Tab>>,
3131
set_active_tab: WriteSignal<usize>,
3232
active_tab: ReadSignal<usize>,
3333
) -> impl IntoView {
@@ -61,16 +61,16 @@ const TABBAR_HEIGHT: f64 = 37.0;
6161
const CONTENT_PADDING: f64 = 10.0;
6262

6363
pub fn tab_navigation_view() -> impl IntoView {
64-
let tabs = vec![Tabs::General, Tabs::Settings, Tabs::Feedback]
64+
let tabs = vec![Tab::General, Tab::Settings, Tab::Feedback]
6565
.into_iter()
66-
.collect::<im::Vector<Tabs>>();
66+
.collect::<im::Vector<Tab>>();
6767
let (tabs, _set_tabs) = create_signal(tabs);
6868
let (active_tab, set_active_tab) = create_signal(0);
6969

7070
let tabs_bar = h_stack((
71-
tab_button(Tabs::General, tabs, set_active_tab, active_tab),
72-
tab_button(Tabs::Settings, tabs, set_active_tab, active_tab),
73-
tab_button(Tabs::Feedback, tabs, set_active_tab, active_tab),
71+
tab_button(Tab::General, tabs, set_active_tab, active_tab),
72+
tab_button(Tab::Settings, tabs, set_active_tab, active_tab),
73+
tab_button(Tab::Feedback, tabs, set_active_tab, active_tab),
7474
))
7575
.style(|s| {
7676
s.flex_row()

0 commit comments

Comments
 (0)