@@ -8,21 +8,26 @@ export default class extends Controller {
88 }
99
1010 addThemeButtons ( ) {
11- const light = "<button class='btn btn-sm btn-primary' data-theme='theme-light'>Light</button>"
12- const dark = "<button class='btn btn-sm btn-primary' data-theme='theme-dark'>Dark</button>"
13- const sepia = "<button class='btn btn-sm btn-primary' data-theme='theme-sepia'>Sepia</button>"
14- const black = "<button class='btn btn-sm btn-primary' data-theme='theme-black-text'>Black</button>"
15- const light2 = "<button class='btn btn-sm btn-primary' data-theme='theme-light2'>L2</button>"
16- const dark2 = "<button class='btn btn-sm btn-primary' data-theme='theme-dark2'>D2</button>"
17- const sepia2 = "<button class='btn btn-sm btn-primary' data-theme='theme-sepia2'>S2</button>"
11+ const light = "<button class='tw-btn tw-btn-sm tw-btn-info' data-theme='theme-light'>Light</button>"
12+ const dark = "<button class='tw-btn tw-btn-sm tw-btn-info' data-theme='theme-dark'>Dark</button>"
13+ const sepia = "<button class='tw-btn tw-btn-sm tw-btn-info' data-theme='theme-sepia'>Sepia</button>"
14+ const black = "<button class='tw-btn tw-btn-sm tw-btn-info' data-theme='theme-black'>Black</button>"
1815
19- this . el . append ( `<div>${ light } ${ light2 } ${ dark } ${ dark2 } ${ sepia } ${ sepia2 } ${ black } </div>` )
16+ const p1 = "<button class='tw-btn tw-btn-sm tw-btn-info' data-theme='theme1'>P1</button>"
17+ const p2 = "<button class='tw-btn tw-btn-sm tw-btn-info' data-theme='theme2'>P2</button>"
18+ const p3 = "<button class='tw-btn tw-btn-sm tw-btn-info' data-theme='theme3'>P3</button>"
19+ const p4 = "<button class='tw-btn tw-btn-sm tw-btn-info' data-theme='theme4'>P4</button>"
20+ const p5 = "<button class='tw-btn tw-btn-sm tw-btn-info' data-theme='theme5'>P5</button>"
21+ const p6 = "<button class='tw-btn tw-btn-sm tw-btn-info' data-theme='theme6'>P6</button>"
22+
23+ this . el . append ( `<div>${ light } ${ dark } ${ sepia } ${ black } ${ p1 } ${ p2 } ${ p3 } ${ p4 } ${ p5 } ${ p6 } </div>` )
2024 }
2125
2226 bindEvents ( ) {
2327 this . el . find ( '[data-theme]' ) . on ( 'click' , ( e ) => {
24- this . el . removeClass ( "theme-light theme-dark theme-sepia theme-light2 theme-dark2 theme-sepia2 theme-black-text" )
25- this . el . addClass ( e . target . dataset . theme )
28+ const theme = e . target . dataset . theme ;
29+ this . el . removeClass ( "theme-light theme-dark theme-sepia theme-black theme-normal theme1 theme2 theme3 theme4 theme5 theme6" )
30+ this . el . addClass ( theme ) ;
2631 } )
2732 }
2833}
0 commit comments