@@ -7,57 +7,54 @@ enum Tabs {
77 About ,
88 Contact
99}
10- let currentTab : Tabs = Tabs . Home ;
1110
1211enum Pages {
1312 Dashboard ,
1413 Settings ,
1514 Profile ,
1615 Help
1716}
18- let currentPage : Pages = Pages . Dashboard ;
1917
2018const table_headers = [ 'ID' , 'Name' , 'Role' ] ;
2119const table = [
2220 { id : 1 , name : 'Alice' , role : 'Admin' } ,
2321 { id : 2 , name : 'Bob' , role : 'User' } ,
2422 { id : 3 , name : 'Charlie' , role : 'Moderator' }
2523]
26- let current_row : number | null = null ;
2724
2825flick . mount ( ( ) => {
2926 const navbar = Navbar ( OffcanvasBrand ( 'Flick' ) , NavbarList ( [
3027 NavbarItem ( 'Home' , ( ) => {
31- currentTab = Tabs . Home ;
28+ flick . ctx . currentTab = Tabs . Home ;
3229 flick . redraw ( ) ;
33- } , currentTab === Tabs . Home ) ,
30+ } , flick . ctx . currentTab === Tabs . Home ) ,
3431 NavbarItem ( 'About' , ( ) => {
35- currentTab = Tabs . About ;
32+ flick . ctx . currentTab = Tabs . About ;
3633 flick . redraw ( ) ;
37- } , currentTab === Tabs . About ) ,
34+ } , flick . ctx . currentTab === Tabs . About ) ,
3835 NavbarItem ( 'Contact' , ( ) => {
39- currentTab = Tabs . Contact ;
36+ flick . ctx . currentTab = Tabs . Contact ;
4037 flick . redraw ( ) ;
41- } , currentTab === Tabs . Contact )
38+ } , flick . ctx . currentTab === Tabs . Contact )
4239 ] ) ) ;
4340
4441 const offcanvas_content = ListGroup ( [
4542 ListGroupItem ( 'Dashboard' , ( ) => {
46- currentPage = Pages . Dashboard ;
43+ flick . ctx . currentPage = Pages . Dashboard ;
4744 flick . redraw ( ) ;
48- } , currentPage === Pages . Dashboard ) ,
45+ } , flick . ctx . currentPage === Pages . Dashboard ) ,
4946 ListGroupItem ( 'Settings' , ( ) => {
50- currentPage = Pages . Settings ;
47+ flick . ctx . currentPage = Pages . Settings ;
5148 flick . redraw ( ) ;
52- } , currentPage === Pages . Settings ) ,
49+ } , flick . ctx . currentPage === Pages . Settings ) ,
5350 ListGroupItem ( 'Profile' , ( ) => {
54- currentPage = Pages . Profile ;
51+ flick . ctx . currentPage = Pages . Profile ;
5552 flick . redraw ( ) ;
56- } , currentPage === Pages . Profile ) ,
53+ } , flick . ctx . currentPage === Pages . Profile ) ,
5754 ListGroupItem ( 'Help' , ( ) => {
58- currentPage = Pages . Help ;
55+ flick . ctx . currentPage = Pages . Help ;
5956 flick . redraw ( ) ;
60- } , currentPage === Pages . Help ) ,
57+ } , flick . ctx . currentPage === Pages . Help ) ,
6158 ListGroupCheckbox ( 'Enable Notifications' , false , ( checked ) => {
6259 console . log ( 'Notifications toggled:' , checked ) ;
6360 } ) ,
@@ -72,9 +69,9 @@ flick.mount(() => {
7269 Button ( 'Click Me' , ( ) => console . log ( 'Button clicked!' ) ) ,
7370 Table ( table_headers , table . map ( item => Row ( [ item . id . toString ( ) , item . name , item . role ] , ( ) => {
7471 console . log ( 'Row clicked:' , item ) ;
75- current_row = item . id ;
72+ flick . ctx . currentRow = item . id ;
7673 flick . redraw ( ) ;
77- } , current_row === item . id ) ) ) ,
74+ } , flick . ctx . currentRow === item . id ) ) ) ,
7875 Offcanvas (
7976 OffcanvasBody ( offcanvas_content ) ,
8077 OffcanvasHeader ( 'Flick Offcanvas' )
0 commit comments