diff --git a/src/App.jsx b/src/App.jsx index 54738ce..b152858 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -3,7 +3,7 @@ import NavBar from '@/components/NavBar/NavBar' import PageRoutes from '@/components/PageRoutes' import "./i18n.js"; -function App() { +const App = () => { return ( <> diff --git a/src/components/Dropdown.jsx b/src/components/Dropdown.jsx index b4afa60..37869ca 100644 --- a/src/components/Dropdown.jsx +++ b/src/components/Dropdown.jsx @@ -1 +1,35 @@ -// TODO (Togzhan & Yi & Aryaa): Create a dropdown component \ No newline at end of file +import React, { useState } from 'react'; + +const Dropdown = ({ label, children }) => { + //use isOpen to keep track of whether the dropdown menu is visible + const [isOpen, setIsOpen] = useState(false); + + return ( +
{ + if(isOpen) { + setIsOpen(false); + } else{ + setIsOpen(true); + } + } + } + > + + {isOpen && ( + // style below for children +
+ {children} +
+ )} +
+ ); +}; + +export default Dropdown; + +