import React, { useState } from 'react'; import { Search, Loader2 } from 'lucide-react'; import { useNavigate } from 'react-router-dom'; import { Logo } from '../components/Logo'; import { StockItem } from '../types'; const POPULAR_STOCKS: StockItem[] = [ { name: '贵州茅台', code: '600519.SH', change: 1.85, type: 'SH' }, ]; export const SearchPage: React.FC = () => { const navigate = useNavigate(); const [searchTerm, setSearchTerm] = useState(''); const [isSearching, setIsSearching] = useState(false); const handleSearch = (e: React.FormEvent) => { e.preventDefault(); if (searchTerm.trim()) { setIsSearching(true); // Simulate loading setTimeout(() => navigate('/dashboard'), 800); } }; const handleCardClick = () => { navigate('/dashboard'); }; return (
{/* Header */}
U
{/* Main Content */}
{/* Search Section */}
setSearchTerm(e.target.value)} className="w-full pl-12 pr-4 py-4 bg-white border border-slate-200 rounded-2xl shadow-sm text-lg focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition-all placeholder:text-slate-400" placeholder="搜索标的..." /> {searchTerm && (
navigate('/dashboard')} className="px-4 py-3 hover:bg-slate-50 cursor-pointer flex items-center gap-3 border-b border-slate-50 last:border-0" >
SH

贵州茅台

600519.SH · Stock

)}
{/* Grid */}
{POPULAR_STOCKS.map((stock) => (
{/* Simple icon based on type */}
{stock.name}
{stock.code} +{stock.change.toFixed(2)}%
))}
{isSearching ? : More data loading...}
); };