11use leptos:: * ;
2- use thaw:: { Button , Tab , TabLabel , Tabs } ;
2+ use leptos_icons:: * ;
3+ use thaw:: { Button , ButtonSize , Tab , TabLabel , Tabs } ;
34
45use crate :: {
56 enums:: QueryTableLayout ,
@@ -26,7 +27,7 @@ pub fn App() -> impl IntoView {
2627 provide_context ( create_rw_signal ( 0.0f32 ) ) ;
2728 provide_context ( ActiveProjectStore :: default ( ) ) ;
2829 provide_context ( TabsStore :: default ( ) ) ;
29- let tabs = use_context :: < tabs:: TabsStore > ( ) . unwrap ( ) ;
30+ let mut tabs = use_context :: < tabs:: TabsStore > ( ) . unwrap ( ) ;
3031
3132 view ! {
3233 <div class="flex h-screen" >
@@ -40,10 +41,16 @@ pub fn App() -> impl IntoView {
4041 children=move |index| {
4142 view! {
4243 <Tab key=index. to_string( ) >
43- <TabLabel class="p-0" slot>
44- <div class="flex flex-row items-center justify-between w-20" >
45- <div>{ ( index + 1 ) . to_string( ) } </div>
46- <button class="rounded-md text-xs" >X </button>
44+ <TabLabel slot>
45+ <div class="flex flex-row items-center justify-between gap-2 h-full text-sm" >
46+ <span>{ format!( "Tab {}" , ( index + 1 ) . to_string( ) ) } </span>
47+ <button
48+ class="rounded-full p-1 hover:bg-gray-100"
49+ on: click=move |_| { tabs. remove_editor( index) }
50+ >
51+
52+ <Icon icon=icondata:: CgClose width="16" height="16" />
53+ </button>
4754 </div>
4855 </TabLabel >
4956 <QueryEditor />
@@ -55,7 +62,9 @@ pub fn App() -> impl IntoView {
5562
5663 </Tabs >
5764 <Button
58- class="absolute top-2 right-2"
65+ size=ButtonSize :: Small
66+ icon=icondata:: TbPlus
67+ class="absolute top-2 right-2 text-sm"
5968 on: click=move |_| {
6069 tabs. active_tabs. update( |prev| * prev += 1 ) ;
6170 tabs. selected_tab
@@ -69,7 +78,7 @@ pub fn App() -> impl IntoView {
6978 }
7079 >
7180
72- "+"
81+ { "Add Tab" }
7382 </Button >
7483 </main>
7584 <Footer />
0 commit comments