undefined / websites.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
13.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Community - WebBag Wonders</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>
</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">WebBag Wonders</span>
</div>
<div className="flex-1 max-w-md mx-4">
<div className="relative">
<input
type="text"
placeholder="Search community..."
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 Comment({ comment }) {
return (
<div className="ml-6 mt-4 pl-4 border-l-2 border-gray-200">
<div className="flex items-center mb-2">
<div className="w-8 h-8 rounded-full bg-gray-300 flex items-center justify-center mr-2">
<i className="fas fa-user text-gray-600 text-xs"></i>
</div>
<span className="text-sm font-medium text-gray-800">{comment.author}</span>
</div>
<p className="text-gray-600 text-sm">{comment.text}</p>
</div>
);
}
function Post({ post }) {
const [isLiked, setIsLiked] = useState(false);
const [likeCount, setLikeCount] = useState(post.likes);
const [showComments, setShowComments] = useState(false);
const [newComment, setNewComment] = useState("");
const handleLike = () => {
setIsLiked(!isLiked);
setLikeCount(isLiked ? likeCount - 1 : likeCount + 1);
};
const handleAddComment = (e) => {
e.preventDefault();
if (newComment.trim()) {
post.comments.push({
id: Date.now(),
author: "You",
text: newComment
});
setNewComment("");
}
};
return (
<div className="bg-white rounded-xl p-6 shadow-md border border-gray-100 mb-6">
<div className="flex items-center mb-4">
<div className="w-10 h-10 rounded-full bg-gray-300 flex items-center justify-center mr-3">
<i className="fas fa-user text-gray-600"></i>
</div>
<div>
<h4 className="font-medium text-gray-800">{post.author}</h4>
<p className="text-gray-500 text-xs">{post.timeAgo}</p>
</div>
</div>
<p className="text-gray-700 mb-4">{post.content}</p>
{post.image && (
<img
src={post.image}
alt="Post"
className="w-full rounded-lg mb-4"
/>
)}
<div className="flex items-center text-gray-500 text-sm">
<button
onClick={handleLike}
className={`flex items-center mr-4 ${isLiked ? 'text-blue-500' : ''}`}
>
<i className={`fas fa-heart mr-1 ${isLiked ? 'text-blue-500' : ''}`}></i>
<span>{likeCount}</span>
</button>
<button
onClick={() => setShowComments(!showComments)}
className="flex items-center"
>
<i className="fas fa-comment mr-1"></i>
<span>{post.comments.length}</span>
</button>
</div>
{showComments && (
<div className="mt-4">
<form onSubmit={handleAddComment} className="mb-4 flex">
<input
type="text"
value={newComment}
onChange={(e) => setNewComment(e.target.value)}
placeholder="Add a comment..."
className="flex-1 py-2 px-3 border border-gray-300 rounded-l-lg focus:outline-none focus:ring-1 focus:ring-blue-300"
/>
<button
type="submit"
className="bg-blue-500 text-white px-4 py-2 rounded-r-lg hover:bg-blue-600"
>
Post
</button>
</form>
{post.comments.map(comment => (
<Comment key={comment.id} comment={comment} />
))}
</div>
)}
</div>
);
}
function CommunityPage() {
const [posts, setPosts] = useState([
{
id: 1,
author: "JaneDoe",
timeAgo: "2 hours ago",
content: "Just discovered this amazing website for learning React! Check it out at https://react-tutorial.app",
likes: 15,
comments: [
{ id: 1, author: "JohnSmith", text: "Thanks for sharing!" },
{ id: 2, author: "DevUser", text: "This is really helpful!" }
]
},
{
id: 2,
author: "TechEnthusiast",
timeAgo: "5 hours ago",
content: "What's your favorite development tool or extension? Mine is VSCode with the GitHub Copilot!",
likes: 8,
comments: [
{ id: 3, author: "CodeMaster", text: "I love using Postman for API testing" },
{ id: 4, author: "WebDev", text: "Tailwind CSS is my go-to for styling" }
],
image: "http://static.photos/technology/640x360/1"
},
{
id: 3,
author: "BookLover",
timeAgo: "1 day ago",
content: "Just finished reading 'Clean Code' by Robert Martin. Highly recommend for all developers!",
likes: 22,
comments: [
{ id: 5, author: "ProgrammingFan", text: "One of my favorites too!" }
],
image: "http://static.photos/books/640x360/2"
}
]);
const [newPost, setNewPost] = useState("");
const handleAddPost = (e) => {
e.preventDefault();
if (newPost.trim()) {
setPosts([
{
id: Date.now(),
author: "You",
timeAgo: "Just now",
content: newPost,
likes: 0,
comments: []
},
...posts
]);
setNewPost("");
}
};
return (
<div className="container mx-auto px-4 py-8">
<h1 className="text-2xl font-bold text-gray-800 mb-6">Community Posts</h1>
<form onSubmit={handleAddPost} className="bg-white rounded-xl p-6 shadow-md border border-gray-100 mb-6">
<textarea
value={newPost}
onChange={(e) => setNewPost(e.target.value)}
placeholder="Share something with the community..."
className="w-full p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-300 mb-3"
rows="3"
></textarea>
<div className="flex justify-end">
<button
type="submit"
className="bg-blue-500 text-white px-6 py-2 rounded-lg hover:bg-blue-600"
>
Post
</button>
</div>
</form>
<div>
{posts.map(post => (
<Post key={post.id} post={post} />
))}
</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">WebBag Wonders</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 WebBag Wonders. All rights reserved.</p>
</div>
</div>
</footer>
);
}
function App() {
return (
<div className="min-h-screen flex flex-col">
<Navbar />
<CommunityPage />
<Footer />
</div>
);
}
ReactDOM.render(<App />, document.getElementById('root'));
</script>
</body>
</html>