Skip to content

Commit

Permalink
Updated routes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aayush259 committed Jul 20, 2024
1 parent 33d4eb6 commit f216366
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/components/home/ProductCategoryCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function ProductCategoryCard({ productName, productImg }) {

return (
<NavLink
to={'/products'}
to={'/E-Commerce/products'}
className="flex flex-col items-center justify-center gap-2 max-w-[90vw] m-auto hover:outline"
>
<img src={productImg} alt="earphone" className="h-60 max-w-[80%] md:max-w-fit" />
Expand Down
12 changes: 6 additions & 6 deletions src/components/nav/Nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ export default function Nav() {
const navigationLinks = [
{
linkText: 'Products',
linkTo: '/products'
linkTo: '/E-Commerce/products'
},
{
linkText: 'Wishlist',
linkTo: '/wishlist'
linkTo: '/E-Commerce/wishlist'
},
{
linkText: 'MyCart',
linkTo: '/cart'
linkTo: '/E-Commerce/cart'
},
{
linkText: 'Account',
linkTo: '/account'
linkTo: '/E-Commerce/account'
},
{
linkText: 'Logout',
linkTo: '/'
linkText: 'Login',
linkTo: '/E-Commerce.login'
},
];

Expand Down
2 changes: 1 addition & 1 deletion src/components/products/ProductCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function ProductCard({ productDetails }) {
/>
</button>

<Link to={`/products/${productName}`}>
<Link to={`/E-Commerce/products/${productName}`}>
<img src={productImg} alt="" className="block m-auto h-60" />

<div className="flex flex-row items-start justify-between my-4">
Expand Down
4 changes: 2 additions & 2 deletions src/components/wishlist/WishlistItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function WishlistItem({ item }) {
/>
</button>

<Link to={`/products/${itemName}`}>
<Link to={`/E-Commerce/products/${itemName}`}>
<img src={itemImage} alt={itemName} className="block m-auto h-60" />

<div className="flex flex-row items-start justify-between my-4">
Expand Down Expand Up @@ -73,7 +73,7 @@ export default function WishlistItem({ item }) {

{inCart ? (
<Link
to="/cart"
to="/E-Commerce/cart"
className="block text-center bg-slate-900 border-2 border-slate-900 text-white w-full mt-4 rounded-md py-[6px] tracking-wider uppercase hover:text-slate-900 hover:bg-white duration-300"
>
Go to Cart
Expand Down
14 changes: 7 additions & 7 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import Login from './components/login/Login.jsx';

const router = createBrowserRouter(
createRoutesFromElements(
<Route path='/' element={<App />}>
<Route path='/E-Commerce/' element={<App />}>
<Route index element={<Home />} />
<Route path='/products' element={<Product />} />
<Route path='/products/:productname' element={<ProductDetail />} />
<Route path='/cart' element={<Cart />} />
<Route path='/wishlist' element={<Wishlist />} />
<Route path='/account' element={<Account />} />
<Route path='/login' element={<Login />} />
<Route path='/E-Commerce/products' element={<Product />} />
<Route path='/E-Commerce/products/:productname' element={<ProductDetail />} />
<Route path='/E-Commerce/cart' element={<Cart />} />
<Route path='/E-Commerce/wishlist' element={<Wishlist />} />
<Route path='/E-Commerce/account' element={<Account />} />
<Route path='/E-Commerce/login' element={<Login />} />
</Route>
)
);
Expand Down
1 change: 1 addition & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
base: "/E-Commerce"
})

0 comments on commit f216366

Please sign in to comment.