diff --git a/frontend/src/components/NavBar.tsx b/frontend/src/components/NavBar.tsx new file mode 100644 index 0000000..1ab762f --- /dev/null +++ b/frontend/src/components/NavBar.tsx @@ -0,0 +1,41 @@ +// NavBar.tsx +import React, { useState, useEffect } from 'react'; +import { useNavigate, useLocation } from 'react-router-dom'; +import { NavItem } from '../components/NavItem'; // adjust the path as needed + +export default function NavBar() { + const navigate = useNavigate(); + const location = useLocation(); + const [selected, setSelected] = useState(location.pathname); + + useEffect(() => { + navigate(selected); + }, [selected]); + + const handleItemClick = (path: any) => { + setSelected(path); + } + + const navItems = [ + { icon: "mdi:book", label: "Courses", path: "/courses" }, + { icon: "mdi:earth", label: "Collab Learning", path: "/collab-learning" }, + { icon: "mdi:clipboard-text-clock", label: "Review", path: "/review" }, + { icon: "mdi:microphone-message", label: "Speaking", path: "/speaking" }, + { icon: "mdi:account", label: "Profile", path: "/profile" }, + ]; + + return ( + + ) +} \ No newline at end of file diff --git a/frontend/src/components/NavItem.tsx b/frontend/src/components/NavItem.tsx new file mode 100644 index 0000000..39e10dd --- /dev/null +++ b/frontend/src/components/NavItem.tsx @@ -0,0 +1,18 @@ +import React from 'react'; +import { Icon } from '@iconify/react'; + +interface NavItemProps { + icon: string; + label: string; + path: string; + selected: string; + handleItemClick: (path: string) => void; +} + +export const NavItem: React.FC = ({ icon, label, path, selected, handleItemClick }) => ( +
handleItemClick(path)}> + + {label} +
+); \ No newline at end of file diff --git a/frontend/src/index.sass b/frontend/src/index.sass index 8b07175..862f8ef 100644 --- a/frontend/src/index.sass +++ b/frontend/src/index.sass @@ -3,7 +3,7 @@ @tailwind utilities $c-default-text: #222 - +$c-default-icon: #888 $c-blue: rgb(28, 176, 246) $c-blue-shadow: rgb(24, 153, 214) $c-green: rgb(88, 204, 2) @@ -104,3 +104,32 @@ h1 .page-pad padding: 2em 1em + +.navbar + position: fixed + bottom: 0 + left: 0 + width: 100% + border-top: solid $c-white-shadow + border-width: 2px 0 0 + display: flex + justify-content: space-around + padding: 10px + color: $c-default-icon + +.navbar-item + text-decoration: none + transition: color 0.3s ease + display: flex + align-items: center + flex-direction: column + + svg + width: 24px + height: 24px + + span + font-size: 12px + + &.active + color: $c-green diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index d8af277..6310248 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -7,6 +7,10 @@ import Welcome from "./pages/Welcome"; import Login from "./pages/Login"; import Signup from "./pages/Signup"; import Course from "./pages/Course"; +import Profile from "./pages/Profile"; +import CollabLearning from './pages/CollabLearning'; +import Review from './pages/Review'; +import Speaking from './pages/Speaking'; const router = createBrowserRouter([ { @@ -24,7 +28,23 @@ const router = createBrowserRouter([ { path: '/courses', element: , - } + }, + { + path: '/collab-learning', + element: + }, + { + path: '/review', + element: + }, + { + path: '/speaking', + element: + }, + { + path: '/profile', + element: + }, ]) const root = ReactDOM.createRoot( diff --git a/frontend/src/pages/CollabLearning.tsx b/frontend/src/pages/CollabLearning.tsx new file mode 100644 index 0000000..ddb23f9 --- /dev/null +++ b/frontend/src/pages/CollabLearning.tsx @@ -0,0 +1,14 @@ +import NavBar from "../components/NavBar" + +export default function CollabLearning() { + + return ( +
+
+

Collaborative Learning Page

+
+ +
+ ) + +} \ No newline at end of file diff --git a/frontend/src/pages/Course.tsx b/frontend/src/pages/Course.tsx index 7819418..24a077e 100644 --- a/frontend/src/pages/Course.tsx +++ b/frontend/src/pages/Course.tsx @@ -1,7 +1,14 @@ -export default function Login() { +import NavBar from "../components/NavBar" + +export default function Course() { return ( -

Course

+
+
+

Course Page

+
+ +
) } \ No newline at end of file diff --git a/frontend/src/pages/Profile.tsx b/frontend/src/pages/Profile.tsx new file mode 100644 index 0000000..c22d036 --- /dev/null +++ b/frontend/src/pages/Profile.tsx @@ -0,0 +1,14 @@ +import NavBar from "../components/NavBar" + +export default function Profile() { + + return ( +
+
+

Profile Page

+
+ +
+ ) + +} \ No newline at end of file diff --git a/frontend/src/pages/Review.tsx b/frontend/src/pages/Review.tsx new file mode 100644 index 0000000..675ac1e --- /dev/null +++ b/frontend/src/pages/Review.tsx @@ -0,0 +1,14 @@ +import NavBar from "../components/NavBar" + +export default function Review() { + + return ( +
+
+

Review Page

+
+ +
+ ) + +} \ No newline at end of file diff --git a/frontend/src/pages/Speaking.tsx b/frontend/src/pages/Speaking.tsx new file mode 100644 index 0000000..ed69c23 --- /dev/null +++ b/frontend/src/pages/Speaking.tsx @@ -0,0 +1,14 @@ +import NavBar from "../components/NavBar" + +export default function Speaking() { + + return ( +
+
+

Speaking Page

+
+ +
+ ) + +} \ No newline at end of file