code of e commerce website
code of e commerce website
tsx (file)
"use client"
import Image from "next/image";
import Link from "next/link";
import { useState } from "react";
return (
<div>
<Image
src="/list.png"
alt="logo"
width={28}
height={28}
className="cursor-pointer"
onClick={() => setOpen((prev) => !prev)}
/>
{open && (
<div className="absolute bg-black text-white left-0 top-20 w-full h-
[calc(100vh)]">
<Link href="/">Home</Link>
<Link href="/about-us">About Us</Link>
<Link href="/contact">Contact</Link>
<Link href="/login">Login</Link>
</div>
)}
</div>
);
};
Navbar.tsx (file)
<Menu/>
</div>
{/* big screen */}
<div className="hidden lg:flex items-center justify-between h-full
gap-8 ">
{/* lft */}
<div className="w-1/3 xl:w-1/2 flex items-center gap-12">
<link href="/" className="flex items-center gap-3">
<Image src="/logo-design-my-shop-04.png" alt="logo" width={150}
height={150}
className="mt-3"/>
</link>
</div>
</div>
{/* right */}
<div className="w-2/4 xl:w-1/2 flex items-center justify-between
gap-8">
<Serchbar/>
<Navicons/>
</div>
</div>
</div>
</div>
)
}
export default Navbar
Navicons.tsx (file)
'use client'
import Image from "next/image"
import Link from "next/link"
const Navicons=()=>{
return(
<div className="flex items-center gap-4 xl:gap-6">
<Image
src='/user.png'
alt="Search Icon"
width={22}
height={22}
className="cursor-pointer"
/>
<Image
src='/store.png'
alt="Search Icon"
width={22}
height={22}
className="cursor-pointer"
/>
</div>
)
}
Searchbar.tsx (file)
'use client';
import Image from "next/image";
import Link from "next/link";