undefined / mybag.html
zeeleo007's picture
create admin dashboard which controls everything add update delete and add manager and there controls and user also and add more features in it and most important enhance home page and add compare and My Bag (same function like favorite) in very selection websites, books and production. add these features in website cards (Name, category, description, url, discount or pricing) also add categories and there pages. add these features in product cards (Name, description, price, category, stock, discount) also add categories and there pages. add these features in book cards (Title, author, description, price, category, stock, discount) and add categories and there pages make it fully professional way and enhance UI of complete website
d8b1d97 verified
Raw History Blame Contribute Delete
12.1 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Bag - WebWizard</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<style>
.card-hover:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
</style>
</head>
<body class="bg-gray-50">
<div id="root"></div>
<script type="text/babel">
const { useState } = React;
function Navbar() {
return (
<nav className="bg-white shadow-sm py-4 px-6 flex items-center justify-between sticky top-0 z-50">
<div className="flex items-center space-x-2">
<i className="fas fa-briefcase text-blue-500 text-2xl"></i>
<span className="text-xl font-semibold text-gray-800">WebWizard</span>
</div>
<div className="flex-1 max-w-md mx-4">
<div className="relative">
<input
type="text"
placeholder="Search..."
className="w-full py-2 px-4 rounded-full border border-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-300"
/>
<button className="absolute right-3 top-2 text-gray-400">
<i className="fas fa-search"></i>
</button>
</div>
</div>
<div className="flex items-center space-x-4">
<button className="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-full text-sm font-medium">
Sign In
</button>
<div className="w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center">
<i className="fas fa-user text-gray-600"></i>
</div>
</div>
</nav>
);
}
function BagItem({ item, onRemove }) {
return (
<div className="bg-white rounded-xl p-6 shadow-md border border-gray-100 mb-4">
<div className="flex">
<div className="w-24 h-24 flex-shrink-0 mr-4">
<img
src={item.image}
alt={item.name}
className="w-full h-full object-contain"
/>
</div>
<div className="flex-1">
<div className="flex justify-between items-start">
<h3 className="text-lg font-semibold text-gray-800 mb-1">{item.name}</h3>
<button
onClick={() => onRemove(item.id)}
className="text-gray-400 hover:text-red-500"
>
<i className="fas fa-times"></i>
</button>
</div>
<p className="text-gray-500 text-sm mb-2">{item.description}</p>
<div className="flex items-center justify-between">
<span className="text-sm font-medium text-gray-700 capitalize">{item.category}</span>
{item.price && (
<span className="text-blue-500 font-medium">${item.price.toFixed(2)}</span>
)}
</div>
</div>
</div>
</div>
);
}
function MyBagPage() {
const [bagItems, setBagItems] = useState([
{
id: 1,
type: 'website',
name: 'React Documentation',
description: 'Official documentation for the React JavaScript library',
category: 'development',
image: 'http://static.photos/websites/200x200/1',
url: 'https://reactjs.org'
},
{
id: 2,
type: 'product',
name: 'Wireless Headphones',
description: 'Noise cancelling wireless headphones with 30h battery',
category: 'electronics',
image: 'http://static.photos/products/200x200/1',
price: 199.99
},
{
id: 3,
type: 'book',
name: 'Clean Code',
description: 'A handbook of agile software craftsmanship',
category: 'programming',
image: 'http://static.photos/books/200x200/1',
price: 29.99
}
]);
const handleRemoveItem = (id) => {
setBagItems(bagItems.filter(item => item.id !== id));
};
return (
<div className="container mx-auto px-4 py-8">
<div className="flex justify-between items-center mb-6">
<h1 className="text-2xl font-bold text-gray-800">My Bag</h1>
<div className="text-gray-500">
{bagItems.length} {bagItems.length === 1 ? 'item' : 'items'}
</div>
</div>
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
<div className="lg:col-span-2">
{bagItems.length > 0 ? (
bagItems.map(item => (
<BagItem
key={item.id}
item={item}
onRemove={handleRemoveItem}
/>
))
) : (
<div className="bg-white rounded-xl p-8 shadow-md border border-gray-100 text-center">
<i className="fas fa-shopping-bag text-4xl text-gray-300 mb-4"></i>
<h3 className="text-xl font-semibold text-gray-800 mb-2">Your bag is empty</h3>
<p className="text-gray-500 mb-4">Start adding items to your bag to see them here</p>
<a
href="index.html"
className="inline-block bg-blue-500 hover:bg-blue-600 text-white px-6 py-2 rounded-lg"
>
Browse Items
</a>
</div>
)}
</div>
<div className="lg:col-span-1">
<div className="bg-white rounded-xl p-6 shadow-md border border-gray-100 sticky top-4">
<h3 className="text-lg font-semibold text-gray-800 mb-4">Bag Summary</h3>
<div className="space-y-3 mb-6">
<div className="flex justify-between">
<span className="text-gray-500">Subtotal</span>
<span className="font-medium">$229.97</span>
</div>
<div className="flex justify-between">
<span className="text-gray-500">Discount</span>
<span className="text-green-500">-$15.00</span>
</div>
<div className="border-t border-gray-200 pt-3 flex justify-between">
<span className="font-medium">Total</span>
<span className="font-bold text-lg">$214.97</span>
</div>
</div>
<button
className="w-full bg-blue-500 hover:bg-blue-600 text-white py-3 rounded-lg font-medium"
disabled={bagItems.length === 0}
>
Checkout
</button>
<p className="text-xs text-gray-500 mt-4 text-center">
By completing your purchase you agree to our Terms of Service
</p>
</div>
</div>
</div>
</div>
);
}
function Footer() {
return (
<footer className="bg-white border-t border-gray-200 py-8 mt-12">
<div className="container mx-auto px-4">
<div className="flex flex-col md:flex-row justify-between items-center">
<div className="mb-4 md:mb-0">
<div className="flex items-center space-x-2">
<i className="fas fa-briefcase text-blue-500 text-xl"></i>
<span className="text-lg font-semibold text-gray-800">WebWizard</span>
</div>
<p className="text-gray-500 text-sm mt-2">Your digital companion for all things web</p>
</div>
<div className="flex space-x-6">
<a href="#" className="text-gray-500 hover:text-blue-500">
<i className="fab fa-twitter"></i>
</a>
<a href="#" className="text-gray-500 hover:text-blue-500">
<i className="fab fa-facebook"></i>
</a>
<a href="#" className="text-gray-500 hover:text-blue-500">
<i className="fab fa-instagram"></i>
</a>
<a href="#" className="text-gray-500 hover:text-blue-500">
<i className="fab fa-github"></i>
</a>
</div>
</div>
<div className="border-t border-gray-200 mt-6 pt-6 text-center text-gray-500 text-sm">
<p>© 2023 WebWizard. All rights reserved.</p>
</div>
</div>
</footer>
);
}
function App() {
return (
<div className="min-h-screen flex flex-col">
<Navbar />
<MyBagPage />
<Footer />
</div>
);
}
ReactDOM.render(<App />, document.getElementById('root'));
</script>
</body>
</html>