import { useState } from 'react'; import { Separator } from './Separator'; function CommentHeader({ onCloseComment, commentCount = 0, commnetClosed = false, }: { onCloseComment?: (c: boolean) => void; commentCount?: number; commnetClosed?: boolean; }) { const [isDropdownOpen, setIsDropdownOpen] = useState(false); const [selectedSort, setSelectedSort] = useState('등록순'); // Default sort option const sortOptions = ['등록순', '최신순', '답글순']; // Changed '답글수' to '답글순' to match list item const handleSortSelection = (option: string) => { setSelectedSort(option); setIsDropdownOpen(false); }; return (
{/* Left Section */}
전체 댓글 {commentCount} {/* Custom Dropdown */}
{/* Adjusted margin from original margin-left: 4px */}
setIsDropdownOpen(!isDropdownOpen)} > {selectedSort} 정렬 기준선택 {/* Screen reader only text */}
{/* Dropdown List */} {isDropdownOpen && (
    {sortOptions.map((option) => ( // Original had strange inline-block and font-size: 0px. Using block and sensible text size.
  • handleSortSelection(option)} > {option}
  • ))}
)} {/* Hidden Select (kept for structure reference, usually not needed with custom dropdown) */}
{/* Hidden Reply Expand Button */}
{/* Right Section */}
{/* Use space-x for spacing */} 본문 보기
); } export function CommentMenuList({ onCloseComment, commnetClosed = false, }: { onCloseComment?: (c: boolean) => void; commnetClosed?: boolean; }) { return
{/* Use space-x for spacing */} 본문 보기
} export default CommentHeader;