import React, { useState, useEffect, useRef } from 'react'; import { cn } from './util/cn'; // Define interfaces for the components interface DropdownItem { name: string; href?: string; } interface DropdownMenuProps { items: DropdownItem[]; isVisible: boolean; widthClass: string; leftClass: string; } interface NavItemWithDropdownProps { title: string; items: DropdownItem[]; widthClass: string; leftClass: string; } interface TickerItem { id: number; text: string; href: string; highlight?: string; highlightClass: string; } // Helper component for dropdown menus const DropdownMenu: React.FC = ({ items, isVisible, widthClass, leftClass }) => (
); // Helper component for Nav Items with Dropdowns const NavItemWithDropdown: React.FC = ({ title, items, widthClass, leftClass }) => { const [isDropdownVisible, setIsDropdownVisible] = useState(false); const timeoutRef = useRef(null); const showDropdown = () => { if (timeoutRef.current) clearTimeout(timeoutRef.current); setIsDropdownVisible(true); }; const hideDropdown = () => { timeoutRef.current = setTimeout(() => { setIsDropdownVisible(false); }, 150); }; return (
  • {title} {title === '갤러리' && }
  • ); }; // Helper component for More Button Dropdown const MoreButtonDropdown: React.FC> = ({ items, widthClass, leftClass }) => { const [isDropdownVisible, setIsDropdownVisible] = useState(false); const timeoutRef = useRef(null); const showDropdown = () => { if (timeoutRef.current) clearTimeout(timeoutRef.current); setIsDropdownVisible(true); }; const hideDropdown = () => { timeoutRef.current = setTimeout(() => { setIsDropdownVisible(false); }, 150); }; return (
  • ); }; // Main Ticker component const InfoTicker: React.FC = () => { const tickerItems: TickerItem[] = [ { id: 1, text: '디시 로터리 응모', href: '#', highlightClass: '' }, { id: 2, text: '어제 %HIGHLIGHT%개 게시글 등록', href: '#', highlight: '911,981', highlightClass: 'text-custom-yellow-light' }, { id: 3, text: '어제 %HIGHLIGHT%개 댓글 등록', href: '#', highlight: '2,527,905', highlightClass: 'text-custom-cyan' }, { id: 4, text: '총 갤러리 수 %HIGHLIGHT%개', href: '#', highlight: '80,516', highlightClass: 'text-custom-pink' }, ]; const [currentItemIndex, setCurrentItemIndex] = useState(0); const [animating, setAnimating] = useState(false); useEffect(() => { const intervalId = setInterval(() => { setAnimating(true); const animTimeout = setTimeout(() => { setAnimating(false); setCurrentItemIndex((prevIndex) => (prevIndex + 1) % tickerItems.length); }, 500); // Animation duration return () => clearTimeout(animTimeout); }, 3000); return () => clearInterval(intervalId); }, [tickerItems.length]); const currentItem = tickerItems[currentItemIndex]; const nextItemIndex = (currentItemIndex + 1) % tickerItems.length; const nextItem = tickerItems[nextItemIndex]; const renderTickerItem = (item: TickerItem) => { const parts = item.text.split('%HIGHLIGHT%'); return ( {parts[0]} {item.highlight && ( {` ${item.highlight} `} )} {parts[1]} ); }; return (
    {renderTickerItem(currentItem)}
    {renderTickerItem(nextItem)}
    ); }; // Main Navigation Bar Component export function GlobalNavigationBar(): JSX.Element { const galleryItems: DropdownItem[] = [ { name: '게임', href: '#' }, { name: '연예/방송', href: '#' }, { name: '스포츠', href: '#' }, { name: '교육/금융/IT', href: '#' }, { name: '여행/음식/생물', href: '#' }, { name: '취미/생활', href: '#' }, ]; const moreItems: DropdownItem[] = [ { name: '디시뉴스', href: '#' }, { name: '디시게임', href: '#' }, { name: '디시위키', href: '#' }, { name: '이벤트', href: '#' }, { name: '디시콘', href: '#' }, ]; return ( ); } export function Header({ isMinorGallery = true, // Default value for isMinorGallery }: { isMinorGallery?: boolean; }) { const [isNightAlertVisible, setIsNightAlertVisible] = useState(true); const logo_img = "/dcin_logo.png"; // Hardcoded based on original script const minor_gallery_img = "/tit_mgallery.png"; // Hardcoded based on original script return (
    {/* Logo */}

    {/* Assuming two logo images or variations were intended */} DCInside Logo {isMinorGallery && ( DCInside Logo Alt )}

    {/* Search Bar */}

    갤러리 검색

    {/* Replaced complex styling with sr-only */}
    {/* Added form action/method placeholders */}
    통합검색 {/* Replaced complex styling with sr-only */}
    {/* Search Suggestions Dropdown (Initially Hidden) */}
    {/* Dropdown content would go here */}
    {/* Another absolute positioned div from source (Initially Hidden) */}
    {/* Content, if any, would go here */}
    {/* Top Right Navigation */}
      {['갤러리', '미니갤', '인물갤', '갤로그', '디시트렌드', '디시뉴스', '디시게임', '이벤트', '디시콘'].map((item) => (
    • {/* Added padding/block */} {item}
    • ))}
    {/* Night Mode Toggle */}
    {/* Added margin from style */} 야간모드 {/* Night Mode Tooltip */} {isNightAlertVisible && (
    setIsNightAlertVisible(false)} >
    {/* Used flex to center text */}

    야간 모드를 이용해 보세요

    )}
    ); } export function VisitHistory({ recentVisits, }: { recentVisits?: { id: number; name: string; isMinor?: boolean; }[]; }) { recentVisits = recentVisits ?? []; // --- State for Interactivity (Example - not fully implemented in static version) --- const [isDropdownOpen, setIsDropdownOpen] = useState(false); // To control the main dropdown visibility const [activeTab, setActiveTab] = useState('recent'); // 'recent' or 'favorites' for the dropdown tabs return (
    {/* Added relative positioning for children */} {/* --- Horizontal Recent Visit Bar --- */}
    {/* Adjusted position to relative, or keep absolute if intended */}

    {activeTab === 'recent' ? '최근 방문' : '즐겨찾기 갤러리'} {/* Dynamic text based on active tab */}

    {/* "Open Layer" Button - Toggles Dropdown */} {/* "Previous" Button */} {/* Visit List Container */}
    {/* Added margins to avoid overlap with buttons */}
      {recentVisits.map((item) => (
    • {/* Adjusted alignment */} {item.name} {item.isMinor && ( )}
    • ))}
    {/* Hidden list from original HTML */}
      {/* "Next" Button */} {/* "All" Button */}
      {/* --- Dropdown/Modal (Initially Hidden) --- */} {/* Controlled by isDropdownOpen state */}
      {/* Adjusted top position relative to bar */}
      {/* Tabs */}
      • {/* Adjusted border color */} {activeTab === 'recent' && (
        )}
      • {activeTab === 'favorites' && (
        )}
      {/* Added clear-both and padding */} {/* Recent Visit Content (Visible when activeTab is 'recent') */}
        {recentVisits.map((item) => (
      • {item.name} {item.isMinor && ( )}
      • ))}
      {/* Favorites Content (Visible when activeTab is 'favorites') */}
      {/* Added min-height and relative */} {/* In a real app, you'd fetch and display favorites or show login prompt */}

      로그인 후 이용 가능합니다.

      ); }