import React, { useState, useEffect } from 'react';
import { Search, User, Calendar, Tag, Heart, MessageCircle, Share2, Filter, Plus, Globe, Users, TrendingUp } from 'lucide-react';
const App = () => {
const [posts, setPosts] = useState([]);
const [filteredPosts, setFilteredPosts] = useState([]);
const [searchTerm, setSearchTerm] = useState('');
const [selectedCategory, setSelectedCategory] = useState('all');
const [showCreateModal, setShowCreateModal] = useState(false);
// Mock data for guest posts
const mockPosts = [
{
id: 1,
title: "The Future of Sustainable Web Development",
author: "Sarah Chen",
authorAvatar: "https://placehold.co/40x40/6366f1/white?text=SC",
category: "Technology",
tags: ["Web Dev", "Sustainability", "Green Tech"],
excerpt: "Exploring how developers can build more environmentally conscious websites and applications in 2024.",
likes: 24,
comments: 8,
date: "2024-01-15",
readTime: "5 min read",
featured: true
},
{
id: 2,
title: "Mindfulness Practices for Remote Teams",
author: "Marcus Johnson",
authorAvatar: "https://placehold.co/40x40/10b981/white?text=MJ",
category: "Lifestyle",
tags: ["Remote Work", "Wellness", "Team Building"],
excerpt: "Simple mindfulness techniques that can transform your remote work experience and boost team productivity.",
likes: 18,
comments: 12,
date: "2024-01-12",
readTime: "4 min read",
featured: false
},
{
id: 3,
title: "The Art of Storytelling in Digital Marketing",
author: "Elena Rodriguez",
authorAvatar: "https://placehold.co/40x40/f59e0b/white?text=ER",
category: "Marketing",
tags: ["Storytelling", "Content Marketing", "Brand Building"],
excerpt: "How to craft compelling narratives that resonate with your audience and drive engagement.",
likes: 31,
comments: 15,
date: "2024-01-10",
readTime: "6 min read",
featured: true
},
{
id: 4,
title: "Building Resilient Microservices Architecture",
author: "David Kim",
authorAvatar: "https://placehold.co/40x40/ef4444/white?text=DK",
category: "Technology",
tags: ["Microservices", "Architecture", "DevOps"],
excerpt: "Key principles and best practices for designing scalable and fault-tolerant microservices systems.",
likes: 27,
comments: 9,
date: "2024-01-08",
readTime: "8 min read",
featured: false
},
{
id: 5,
title: "The Psychology of Color in Brand Design",
author: "Amira Hassan",
authorAvatar: "https://placehold.co/40x40/8b5cf6/white?text=AH",
category: "Design",
tags: ["Color Theory", "Branding", "Psychology"],
excerpt: "Understanding how color choices impact consumer behavior and brand perception in digital spaces.",
likes: 22,
comments: 7,
date: "2024-01-05",
readTime: "5 min read",
featured: false
},
{
id: 6,
title: "Financial Literacy for Young Entrepreneurs",
author: "James Wilson",
authorAvatar: "https://placehold.co/40x40/06b6d4/white?text=JW",
category: "Business",
tags: ["Finance", "Entrepreneurship", "Investing"],
excerpt: "Essential financial concepts every young business owner should master to build sustainable ventures.",
likes: 19,
comments: 11,
date: "2024-01-03",
readTime: "7 min read",
featured: false
}
];
const categories = [
{ id: 'all', name: 'All Categories', icon: Globe },
{ id: 'technology', name: 'Technology', icon: TrendingUp },
{ id: 'design', name: 'Design', icon: TrendingUp },
{ id: 'marketing', name: 'Marketing', icon: TrendingUp },
{ id: 'business', name: 'Business', icon: TrendingUp },
{ id: 'lifestyle', name: 'Lifestyle', icon: TrendingUp }
];
useEffect(() => {
setPosts(mockPosts);
setFilteredPosts(mockPosts);
}, []);
useEffect(() => {
let filtered = posts;
if (searchTerm) {
filtered = filtered.filter(post =>
post.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
post.excerpt.toLowerCase().includes(searchTerm.toLowerCase()) ||
post.tags.some(tag => tag.toLowerCase().includes(searchTerm.toLowerCase()))
);
}
if (selectedCategory !== 'all') {
filtered = filtered.filter(post =>
post.category.toLowerCase() === selectedCategory.toLowerCase()
);
}
setFilteredPosts(filtered);
}, [searchTerm, selectedCategory, posts]);
const handleLike = (postId) => {
setPosts(posts.map(post =>
post.id === postId
? { ...post, likes: post.likes + 1 }
: post
));
};
const CreatePostModal = () => (
Create Guest Post
);
return (
{/* Header */}
window.huggingface={variables:{"SPACE_CREATOR_USER_ID":"63e208c1419922d5a6d49c52"}};>
{/* Hero Section */}
Share Your Voice, Expand Your Reach
Connect with publishers and writers for quality guest post exchanges
{/* Stats Section */}
{/* Main Content */}
{/* Search and Filter Bar */}
{/* Categories */}
{categories.map(category => {
const IconComponent = category.icon;
return (
);
})}
{/* Featured Posts */}
Featured Guest Posts
{filteredPosts.filter(post => post.featured).map(post => (
{post.category}
{post.readTime}
{post.title}
{post.excerpt}
{post.tags.map(tag => (
{tag}
))}
{post.author}
{new Date(post.date).toLocaleDateString()}
))}
{/* All Posts */}
All Guest Posts
{filteredPosts.map(post => (
{post.category}
{post.readTime}
{post.title}
{post.excerpt}
{post.tags.slice(0, 2).map(tag => (
{tag}
))}
{post.tags.length > 2 && (
+{post.tags.length - 2}
)}
{post.author}
{new Date(post.date).toLocaleDateString()}
))}
{filteredPosts.length === 0 && (
No guest posts found matching your criteria.
)}
{/* Footer */}
{/* Create Post Modal */}
{showCreateModal &&
}
);
};
export default App;