-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDropdown.js
More file actions
45 lines (37 loc) · 1.25 KB
/
Dropdown.js
File metadata and controls
45 lines (37 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React, {useState} from 'react';
import {DescriptorItems} from '../Navigation_Descriptor';
import './dropdown.css';
import {Link} from 'react-router-dom';
/**
* @Description: This is the dropdown menu that is used in the navigation bar.
* @briandesignz/react-dropdown-menu is used to create the dropdown menu.
* @returns {JSX.Element}
* @constructor
*/
function Dropdown() {
const [click, setClick] = useState(false);
const handleClick = () => setClick(!click);
return (
<>
<ul
onClick = {handleClick}
className = {`${click ? 'dropdown-menu clicked ' : 'dropdown-menu'}`}
>
{DescriptorItems.map((item, index) => {
return (
<li key = {index} className="bg-gray-300 hover:bg-gray-400 dark:bg-lightDark dark:hover:bg-darkGray">
<Link
className = {`${item.class} text-gray-700 dark:text-gray-200 fontFamily-themeFont font-bold`}
to = {item.path}
onClick = {() => setClick(false)}
>
{item.title}
</Link>
</li>
);
})}
</ul>
</>
);
}
export default Dropdown;