From 6d7bad560e6ce560989b4a77f066a5c2274a758e Mon Sep 17 00:00:00 2001 From: jkarenzi Date: Thu, 20 Jun 2024 21:52:29 +0200 Subject: [PATCH] feat(navbar): implement navbar -implement reusable navbar component -add appropriate tests [Delivers #21] --- src/__test__/navbar.test.tsx | 2 +- src/components/Navbar.tsx | 30 +++++++++++++++--------------- src/layout/HomeLayout.tsx | 5 +++-- src/pages/About.tsx | 4 +--- src/pages/Contact.tsx | 4 +--- src/pages/Home.tsx | 2 +- src/pages/Shop.tsx | 4 +--- src/routes/AppRoutes.tsx | 6 ++++++ tailwind.config.js | 4 +++- 9 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/__test__/navbar.test.tsx b/src/__test__/navbar.test.tsx index 70a8ab2a..4842665b 100644 --- a/src/__test__/navbar.test.tsx +++ b/src/__test__/navbar.test.tsx @@ -47,7 +47,7 @@ describe('Navbar Component', () => { ); expect(screen.getByText('Shop')).toHaveClass( - 'border-b-[2px] border-custom-purple text-custom-purple' + 'border-b-[2px] border-primary text-primary' ); }); diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 00a84352..80aeeedd 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -6,7 +6,7 @@ function Navbar() { const [toggleMenu, setToggleMenu] = useState(false); const [toggleProfileMenu, setToggleProfileMenu] = useState(false); return ( -
+
hamburger
logo -

Dynamites

+

Dynamites

{toggleMenu && ( -
+
Home Shop About Contact -
+
edit

Edit profile

@@ -94,7 +94,7 @@ function Navbar() {

Preferences

-
+
moon

Night mode

@@ -107,15 +107,15 @@ function Navbar() { help

Help center

-
+
signout

Sign out

)} {toggleProfileMenu && ( -
-
+
+
edit

Edit profile

@@ -125,7 +125,7 @@ function Navbar() {

Preferences

-
+
moon

Night mode

@@ -138,7 +138,7 @@ function Navbar() { help

Help center

-
+
signout

Sign out

diff --git a/src/layout/HomeLayout.tsx b/src/layout/HomeLayout.tsx index 4917b997..09dd98f1 100644 --- a/src/layout/HomeLayout.tsx +++ b/src/layout/HomeLayout.tsx @@ -1,13 +1,14 @@ import { Outlet } from 'react-router-dom'; +import Navbar from '@/components/Navbar'; function HomeLayout() { return (
-
Nav
+
-
Fotter
+
Footer
); } diff --git a/src/pages/About.tsx b/src/pages/About.tsx index c1d393b8..06323e81 100644 --- a/src/pages/About.tsx +++ b/src/pages/About.tsx @@ -1,7 +1,5 @@ -import Navbar from '@/components/Navbar'; - function About() { - return ; + return

About

; } export default About; diff --git a/src/pages/Contact.tsx b/src/pages/Contact.tsx index 7887cd41..3f288ff1 100644 --- a/src/pages/Contact.tsx +++ b/src/pages/Contact.tsx @@ -1,7 +1,5 @@ -import Navbar from '@/components/Navbar'; - function Contact() { - return ; + return

Contact

; } export default Contact; diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 4d0a7187..72196de9 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -2,4 +2,4 @@ function Home() { return

Welcome to Dynamites E-commerce

; } -export default Home; \ No newline at end of file +export default Home; diff --git a/src/pages/Shop.tsx b/src/pages/Shop.tsx index d7e2c684..3d513ec1 100644 --- a/src/pages/Shop.tsx +++ b/src/pages/Shop.tsx @@ -1,7 +1,5 @@ -import Navbar from '@/components/Navbar'; - function Shop() { - return ; + return

Shop

; } export default Shop; diff --git a/src/routes/AppRoutes.tsx b/src/routes/AppRoutes.tsx index 08b03535..16b3995b 100644 --- a/src/routes/AppRoutes.tsx +++ b/src/routes/AppRoutes.tsx @@ -2,6 +2,9 @@ import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; import HomeLayout from '@/layout/HomeLayout'; import Home from '@/pages/Home'; import ErrorPage from '@/pages/ErrorPage'; +import Shop from '@/pages/Shop'; +import About from '@/pages/About'; +import Contact from '@/pages/Contact'; function AppRoutes() { return ( @@ -9,6 +12,9 @@ function AppRoutes() { }> } /> + } /> + } /> + } /> } /> {/* Add many routes as you want */} diff --git a/tailwind.config.js b/tailwind.config.js index f63f318e..410a5761 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -18,7 +18,9 @@ export default { grayDark: '#CCD0D8', grayLight: '#F3F4F6', redBg: '#DC2627', - black: '#171A1F', + textBlack: '#171A1F', + lightGrey:'#DEE1E6', + grey: '#565D6D' }, fontFamily: { Lexend: ['Lexend'],