|
1 |
| -import React from 'react'; |
| 1 | +import React, { useState } from 'react'; |
2 | 2 | import Avatar from '@mui/material/Avatar';
|
3 |
| -//commenting out the line below breaks the app |
4 | 3 | import logo from '../../public/icons/win/logo.png';
|
5 |
| -import NavbarDropDown from './NavBarButtons'; |
| 4 | +import NewExportButton from './NewExportButton'; |
6 | 5 | import { useSelector } from 'react-redux';
|
7 | 6 | import { RootState } from '../../redux/store';
|
| 7 | +import Button from '@mui/material/Button'; |
| 8 | +import MoreVertIcon from '@mui/icons-material/MoreVert'; |
| 9 | +import NavBarButtons from './NavBarButtons'; |
8 | 10 |
|
| 11 | +const NavBar = () => { |
| 12 | + const [dropMenu, setDropMenu] = useState(false); |
| 13 | + const isDarkMode = useSelector((state: RootState) => state.darkMode.isDarkMode); |
9 | 14 |
|
10 |
| -const NavBar = (props) => { |
11 |
| - |
12 |
| - // for dropdown navbar |
13 |
| - const [dropMenu, setDropMenu] = React.useState(false); |
14 |
| - const isDarkMode = useSelector((state:RootState)=>state.darkMode.isDarkMode) |
| 15 | + const buttonContainerStyle = { |
| 16 | + display: 'flex', |
| 17 | + alignItems: 'center', |
| 18 | + justifyContent: 'flex-start', |
| 19 | + }; |
| 20 | + |
| 21 | + const buttonStyle = { |
| 22 | + backgroundColor: '#333', |
| 23 | + border: 'none', |
| 24 | + color: isDarkMode ? 'lightgray' : 'white', |
| 25 | + fontSize: '12px', |
| 26 | + padding: '8px 12px', |
| 27 | + cursor: 'pointer', |
| 28 | + marginRight: '10px', |
| 29 | + marginLeft: '5px', |
| 30 | + borderRadius: '4px', |
| 31 | + }; |
| 32 | + |
| 33 | + const moreVertButtonStyle = { |
| 34 | + backgroundColor: '#333', |
| 35 | + border: '1px solid #333', |
| 36 | + padding: '0', |
| 37 | + cursor: 'pointer', |
| 38 | + display: 'flex', |
| 39 | + alignItems: 'center', |
| 40 | + justifyContent: 'flex-start', |
| 41 | + borderRadius: '4px', |
| 42 | + width: '30px', |
| 43 | + minWidth: '20px', |
| 44 | + marginLeft: '0px', |
| 45 | + marginRight: '10px', |
| 46 | + }; |
15 | 47 |
|
16 | 48 | return (
|
17 |
| - <nav className="main-navbar" style={isDarkMode ? {backgroundColor: '#013365'} : {backgroundColor: 'white'}}> |
18 |
| - <div className="main-logo"> |
19 |
| - <Avatar src={logo}></Avatar> |
20 |
| - <h1 style={isDarkMode ? {color: 'white'} : {color: '#013365'}}>ReacType</h1> |
21 |
| - </div> |
22 |
| - <div onMouseLeave={()=>setDropMenu(false)}> |
23 |
| - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" className="bi bi-gear-wide-connected navbar-icon" viewBox="0 0 16 16" |
24 |
| - onMouseOver={()=>setDropMenu(true)}> |
25 |
| - <path d="M7.068.727c.243-.97 1.62-.97 1.864 0l.071.286a.96.96 0 0 0 1.622.434l.205-.211c.695-.719 1.888-.03 1.613.931l-.08.284a.96.96 0 0 0 1.187 1.187l.283-.081c.96-.275 1.65.918.931 1.613l-.211.205a.96.96 0 0 0 .434 1.622l.286.071c.97.243.97 1.62 0 1.864l-.286.071a.96.96 0 0 0-.434 1.622l.211.205c.719.695.03 1.888-.931 1.613l-.284-.08a.96.96 0 0 0-1.187 1.187l.081.283c.275.96-.918 1.65-1.613.931l-.205-.211a.96.96 0 0 0-1.622.434l-.071.286c-.243.97-1.62.97-1.864 0l-.071-.286a.96.96 0 0 0-1.622-.434l-.205.211c-.695.719-1.888.03-1.613-.931l.08-.284a.96.96 0 0 0-1.186-1.187l-.284.081c-.96.275-1.65-.918-.931-1.613l.211-.205a.96.96 0 0 0-.434-1.622l-.286-.071c-.97-.243-.97-1.62 0-1.864l.286-.071a.96.96 0 0 0 .434-1.622l-.211-.205c-.719-.695-.03-1.888.931-1.613l.284.08a.96.96 0 0 0 1.187-1.186l-.081-.284c-.275-.96.918-1.65 1.613-.931l.205.211a.96.96 0 0 0 1.622-.434l.071-.286zM12.973 8.5H8.25l-2.834 3.779A4.998 4.998 0 0 0 12.973 8.5zm0-1a4.998 4.998 0 0 0-7.557-3.779l2.834 3.78h4.723zM5.048 3.967c-.03.021-.058.043-.087.065l.087-.065zm-.431.355A4.984 4.984 0 0 0 3.002 8c0 1.455.622 2.765 1.615 3.678L7.375 8 4.617 4.322zm.344 7.646.087.065-.087-.065z"/> |
26 |
| - </svg> |
27 |
| - <NavbarDropDown dropMenu={dropMenu}></NavbarDropDown> |
28 |
| - </div> |
29 |
| - </nav> |
30 |
| - ) |
31 |
| -} |
| 49 | + <nav className="main-navbar" style={isDarkMode ? { backgroundColor: '#013365' } : { backgroundColor: 'white' }}> |
| 50 | + <div className="main-logo"> |
| 51 | + <Avatar src={logo}></Avatar> |
| 52 | + <h1 style={isDarkMode ? { color: 'white' } : { color: '#013365' }}>ReacType</h1> |
| 53 | + </div> |
| 54 | + <div style={buttonContainerStyle}> |
| 55 | + <button style={buttonStyle}>Share</button> |
| 56 | + <NewExportButton /> |
| 57 | + <Button |
| 58 | + style={moreVertButtonStyle} |
| 59 | + variant="contained" |
| 60 | + color="primary" |
| 61 | + onClick={() => setDropMenu((prevDropMenu) => !prevDropMenu)} |
| 62 | + > |
| 63 | + <MoreVertIcon style={{ color: 'white' }} /> |
| 64 | + </Button> |
| 65 | + <NavBarButtons dropMenu={dropMenu} setDropMenu={setDropMenu} style={{ color: 'white' }} /> |
| 66 | + </div> |
| 67 | + </nav> |
| 68 | + ); |
| 69 | +}; |
32 | 70 |
|
33 | 71 | export default NavBar;
|
0 commit comments