File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,11 @@ import ChevronRightIcon from '@material-ui/icons/ChevronRight';
3434import Logo from './logo.jsx' ;
3535
3636
37+ // VARIABLES //
38+
39+ const RE_FORWARD_SLASH = / \/ / g;
40+
41+
3742// MAIN //
3843
3944class MenuBar extends Component {
@@ -50,9 +55,16 @@ class MenuBar extends Component {
5055 const history = this . props . history ;
5156 const pathname = history . location . pathname ;
5257 if ( ! pathname . endsWith ( this . state . activePkg ) ) {
53- this . setState ( {
54- activePkg : pathname . substring ( pathname . indexOf ( '@stdlib' ) )
55- } ) ;
58+ const packagePath = pathname . substring ( pathname . indexOf ( '@stdlib' ) ) ;
59+ const newState = {
60+ [ packagePath ] : true ,
61+ activePkg : packagePath
62+ } ;
63+ let match ;
64+ while ( ( match = RE_FORWARD_SLASH . exec ( packagePath ) ) !== null ) {
65+ newState [ packagePath . substring ( 0 , match . index ) ] = true ;
66+ }
67+ this . setState ( newState ) ;
5668 }
5769 }
5870
You can’t perform that action at this time.
0 commit comments