File tree Expand file tree Collapse file tree 3 files changed +23
-9
lines changed Expand file tree Collapse file tree 3 files changed +23
-9
lines changed Original file line number Diff line number Diff line change 5353 & :not (.mdc-tab--active ) .mdc-tab__text-label {
5454 color : var (--mdc-theme-on-surface );
5555 }
56+ .mdc-tab__ripple :hover ::before {
57+ opacity : 0.5 ;
58+ }
59+ .mdc-tab__ripple.mdc-ripple-upgraded--background-focused ::before {
60+ opacity : 0.5 ;
61+ }
5662 }
5763}
Original file line number Diff line number Diff line change @@ -48,12 +48,18 @@ export const AppBar: React.FC<React.PropsWithChildren<Props>> = ({
4848 </ Tab >
4949 ) ) ;
5050
51- const activeTabIndex = navRoutes . findIndex ( ( r ) =>
52- matchPath ( location . pathname , {
53- path : r . path ,
54- exact : r . exact ,
55- } )
56- ) ;
51+ const [ activeTabIndex , setActiveTab ] = React . useState ( 0 ) ;
52+
53+ React . useEffect ( ( ) => {
54+ setActiveTab (
55+ navRoutes . findIndex ( ( r ) =>
56+ matchPath ( location . pathname , {
57+ path : r . path ,
58+ exact : r . exact ,
59+ } )
60+ )
61+ ) ;
62+ } , [ location . pathname , navRoutes ] ) ;
5763
5864 return (
5965 < ThemeProvider
@@ -73,7 +79,11 @@ export const AppBar: React.FC<React.PropsWithChildren<Props>> = ({
7379 </ Typography >
7480 </ div >
7581 </ div >
76- < TabBar theme = "onSurface" activeTabIndex = { activeTabIndex } >
82+ < TabBar
83+ theme = "onSurface"
84+ activeTabIndex = { activeTabIndex }
85+ onActivate = { ( evt ) => setActiveTab ( evt . detail . index ) }
86+ >
7787 { tabs }
7888 </ TabBar >
7989 </ TopAppBar >
Original file line number Diff line number Diff line change @@ -58,8 +58,6 @@ const root = createRoot(container!);
5858// https://github.com/remix-run/react-router/issues/7870
5959root . render (
6060 < RMWCProvider
61- // Globally disable ripples
62- ripple = { false }
6361 typography = { {
6462 /** Make headline3 <h3> instaed of div or span */
6563 headline3 : 'h3' ,
You can’t perform that action at this time.
0 commit comments