- Set up Vite + React + TypeScript project - Configure Tailwind CSS v4 with PostCSS - Create project structure (components, types, data) - Implement core features: - Header with search functionality - PostCard component for displaying posts - PostList with community filtering (전체/디씨/루리웹/아카) - PostModal for detailed post view - Add mock data for 3 communities (DCInside, Ruliweb, Arcalive) - Update README with project documentation
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
|
|
interface HeaderProps {
|
|
onSearch: (query: string) => void;
|
|
}
|
|
|
|
const Header: React.FC<HeaderProps> = ({ onSearch }) => {
|
|
const [searchQuery, setSearchQuery] = React.useState('');
|
|
|
|
const handleSearch = (e: React.FormEvent) => {
|
|
e.preventDefault();
|
|
onSearch(searchQuery);
|
|
};
|
|
|
|
return (
|
|
<header className="bg-white shadow-md sticky top-0 z-10">
|
|
<div className="max-w-7xl mx-auto px-4 py-4">
|
|
<div className="flex items-center justify-between">
|
|
<h1 className="text-2xl font-bold text-gray-800">
|
|
한국 커뮤니티 애그리게이터
|
|
</h1>
|
|
<form onSubmit={handleSearch} className="flex gap-2">
|
|
<input
|
|
type="text"
|
|
value={searchQuery}
|
|
onChange={(e) => setSearchQuery(e.target.value)}
|
|
placeholder="게시글 검색..."
|
|
className="px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
/>
|
|
<button
|
|
type="submit"
|
|
className="px-6 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors"
|
|
>
|
|
검색
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
);
|
|
};
|
|
|
|
export default Header;
|