1
1
use leptos:: { html:: * , * } ;
2
- use thaw:: {
3
- Button ,
4
- Tab ,
5
- //TabProps,
6
- Tabs ,
7
- // TabsProps
8
- } ;
2
+ use thaw:: { Button , ButtonProps , Tab , TabProps , Tabs , TabsProps } ;
9
3
10
4
use crate :: { footer, query_editor, query_table, sidebar, store:: tabs} ;
11
5
@@ -21,56 +15,52 @@ pub fn component() -> impl IntoView {
21
15
. child (
22
16
main ( )
23
17
. classes ( "flex-1 overflow-y-scroll" )
24
- . child (
25
- view ! {
26
- <Tabs value=tabs. selected_tab>
27
- <For each=move || ( 0 ..tabs. active_tabs. get( ) ) key=|index| index. to_string( ) let : index>
28
- <Tab key=index. to_string( ) label=( index + 1 ) . to_string( ) >
29
- { query_editor:: component( ) }
30
- { query_table:: component( ) }
31
- </Tab >
32
- </For >
33
- </Tabs >
34
- <Button on_click=move |_| {
35
- tabs. active_tabs. update( |prev| * prev += 1 ) ;
36
- tabs. selected_tab. update( |prev| * prev = ( tabs. active_tabs. get( ) - 1 ) . to_string( ) ) ;
37
- } >"+1" </Button >
38
- } ) ,
39
- // .child(Tabs(TabsProps {
40
- // value: tabs.selected_tab,
41
- // class: MaybeSignal::Static(String::new()),
42
- // children: Children::to_children(move || {
43
- // Fragment::new(vec![
44
- // For(ForProps {
45
- // each: move || (0..tabs.active_tabs.get()),
46
- // key: |index| index.to_string(),
47
- // children: move |index| {
48
- // Tab(TabProps {
49
- // class: MaybeSignal::Static(String::new()),
50
- // key: index.to_string(),
51
- // label: (index + 1).to_string(),
52
- // children: Children::to_children(move || {
53
- // Fragment::new(vec![
54
- // query_editor::component().into_view(),
55
- // query_table::component().into_view(),
56
- // ])
57
- // }),
58
- // })
59
- // },
60
- // })
61
- // .into_view(),
62
- // button()
63
- // .on(ev::click, move |_| {
64
- // tabs.active_tabs.update(|prev| *prev += 1);
65
- // tabs
66
- // .selected_tab
67
- // .update(|prev| *prev = (tabs.active_tabs.get() - 1).to_string());
68
- // })
69
- // .child("+")
70
- // .into_view(),
71
- // ])
72
- // }),
73
- // })),
18
+ . child ( div ( ) . child ( Tabs ( TabsProps {
19
+ value : tabs. selected_tab ,
20
+ class : MaybeSignal :: default ( ) ,
21
+ children : Children :: to_children ( move || {
22
+ Fragment :: new ( vec ! [ For ( ForProps {
23
+ each: move || ( 0 ..tabs. active_tabs. get( ) ) ,
24
+ key: |index| index. to_string( ) ,
25
+ children: move |index| {
26
+ Fragment :: new( vec![ Tab ( TabProps {
27
+ class: MaybeSignal :: default ( ) ,
28
+ key: index. to_string( ) ,
29
+ label: ( index + 1 ) . to_string( ) ,
30
+ children: Children :: to_children( move || {
31
+ Fragment :: new( vec![
32
+ query_editor:: component( ) . into_view( ) ,
33
+ query_table:: component( ) . into_view( ) ,
34
+ ] )
35
+ } ) ,
36
+ } )
37
+ . into_view( ) ] )
38
+ } ,
39
+ } )
40
+ . into_view( ) ] )
41
+ } ) ,
42
+ } ) ) )
43
+ . child ( Button ( ButtonProps {
44
+ style : MaybeSignal :: default ( ) ,
45
+ class : MaybeSignal :: Static ( String :: from ( "absolute top-2 right-2" ) ) ,
46
+ variant : MaybeSignal :: default ( ) ,
47
+ color : MaybeSignal :: default ( ) ,
48
+ size : MaybeSignal :: default ( ) ,
49
+ round : MaybeSignal :: default ( ) ,
50
+ circle : MaybeSignal :: default ( ) ,
51
+ icon : None ,
52
+ loading : MaybeSignal :: default ( ) ,
53
+ disabled : MaybeSignal :: default ( ) ,
54
+ on_click : Some ( Callback :: from ( move |_| {
55
+ tabs. active_tabs . update ( |prev| * prev += 1 ) ;
56
+ tabs
57
+ . selected_tab
58
+ . update ( |prev| * prev = ( tabs. active_tabs . get ( ) - 1 ) . to_string ( ) ) ;
59
+ } ) ) ,
60
+ children : Some ( Box :: new ( move || {
61
+ Fragment :: new ( vec ! [ p( ) . child( "+" ) . into_view( ) ] )
62
+ } ) ) ,
63
+ } ) ) ,
74
64
)
75
65
. child ( footer:: component ( ) ) ,
76
66
)
0 commit comments