-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pb with color of the select tab depending of the url path
- Loading branch information
1 parent
c25d0d6
commit 13f146c
Showing
3 changed files
with
36 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-env", | ||
["@babel/preset-react", {"runtime": "automatic"}] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { useLocation } from 'react-router-dom'; | ||
import { Menu, Icon } from 'antd'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
const NavigationMenu = (): JSX.Element => { | ||
const location = useLocation(); | ||
|
||
const getSelectedKeysByUrl = () => { | ||
if(location.pathname === '/') return ['1']; | ||
else if(location.pathname === '/download') return ['1']; | ||
else if(location.pathname === '/trends') return ['2']; | ||
} | ||
|
||
return ( | ||
<Menu | ||
mode="inline" | ||
defaultOpenKeys={['sub1']} | ||
selectedKeys={getSelectedKeysByUrl()} | ||
style={{ height: '100%', borderRight: 0, marginTop: 20 }} | ||
> | ||
<Menu.Item key="1"><Link to="/download"><Icon type="cloud-download" />Download</Link></Menu.Item> | ||
<Menu.Item key="2"><Link to="/trends"><Icon type="line-chart" />Trends</Link></Menu.Item> | ||
</Menu> | ||
) | ||
} | ||
|
||
export default NavigationMenu; |