import { cn } from './util/cn'; export type AuthorData = { // 운영자 type: "operator" } | { // 고닉 // 중복 불가능 닉네임 type: "nickname", nickname: string, // 파딱, 주딱 구분을 위한 userType userType?: "manager" | "submanager" // Optional, if applicable } | { // 유동닉 type: "IP", // IP 주소 ip: string, } | { // 반유동닉 // 중복 가능 닉네임 type: "semi-nickname", nickname: string, } // --- Data Interface (Remains the same) --- export interface TableRowData { id: string | number; category: string; titleText: string; commentCount?: number; // e.g., "icon_notice", "icon_pic", "icon_txt", "icon_survey" variant?: "icon_notice" | "icon_recoming" | "icon_recomovie" | "icon_pic" | "icon_txt" | "icon_survey" | "icon_ad" | "icon_dctrend"; // e.g., "운영자", "고닉", "반유동", "유동닉" author?: { type: "operator" } | { type: "nickname", nickname: string, userType?: "manager" | "submanager" // Optional, if applicable } | { type: "IP", ip: string, } | { type: "semi-nickname", nickname: string, } date: string; views: "" | "-" | number; recommendations: "" | "-" | number; // Special flags for row types affecting style/structure isNotice?: boolean; isAdOrSurvey?: boolean; isNews?: boolean; // Handle the last row type specifically if needed titleLinkUrl?: string; // Optional URL for title authorLinkUrl?: string; // Optional URL for author } // --- Child Component: TableRow --- interface TableRowProps { rowData: TableRowData; } const NicknameImagePath = { "주딱": "/fix_managernik.gif", "파딱": "/fix_sub_managernik.gif", "반유동": "/nik.gif", "default": "/fix_nik.gif" } export function TableRow({ rowData }: TableRowProps) { const { id, category, titleText, commentCount, variant, date, views, recommendations, isNotice, isAdOrSurvey, isNews, titleLinkUrl = "#", authorLinkUrl = "#", author, } = rowData; const iconTable = { icon_notice: "0px 0px", icon_recoming: "0px -193px", icon_recomovie: "0px -193px", icon_pic: "0px -100px", icon_txt: "0px -123px", icon_survey: "0px -170px", icon_ad: "0px -193px", icon_dctrend: "-3px -877px", // Example for news } const iconPosition = iconTable[variant ?? "icon_txt"]; // Default to undefined if not found // --- Base Cell Styles --- // Note: some styles like height/padding might be slightly different due to Tailwind defaults vs specific px const tdBaseClasses = 'border-t border-custom-gray-light align-middle text-custom-gray-dark h-[25px] relative px-1 py-[2px]'; // Approximates tdBaseStyle const tdCenterClasses = cn(tdBaseClasses, "text-center font-tahoma text-[11px] pt-[1px] pb-[2px]"); // Approximates tdCenterStyle // --- Standard Row Rendering --- return ( {isNews ? "" : id} {category} {iconPosition && ( )} {/* Title text - boldness handled by titleLinkClasses */} {titleText} {commentCount !== undefined && commentCount > 0 && ( [{commentCount}] )} {author?.type === "operator" ? ( 운영자 ) : ( <> {/* Author Name Span */} {/* Inner em/span for potential finer control if needed */} {author?.type === "nickname" ? author?.nickname : "ㅇㅇ"} {/* Author IP */} {author?.type === "IP" && ( ({author.ip}) )} {/* Author Icon Placeholder */} {author?.type !== "IP" && ( {/* Replace with actual icon component or img tag */} icon )} )} {date} {views} {recommendations} ); } // --- Main Component: Table --- export function GalleryTable(props: { data: TableRowData[]; }) { const { data } = props; // Destructure props to get data // --- Base TH Styles --- const thBaseClasses = 'bg-transparent h-[37px] border-t-2 border-b border-custom-blue-dark align-middle text-center text-custom-gray-dark font-appleDotum'; // Uses config colors return ( {/* Screen Reader Only Caption */} {/* Column Widths */} {/* Table Header */} {/* Note: Original CSS applied right border to all TH. Tailwind border utilities apply to all sides unless specified (e.g., border-l), so the above covers it. If you only wanted specific borders, you'd adjust.*/} {/* Table Body */} {data.map((row, index) => ( // Using id-index key for potential non-unique IDs between notices/regular posts ))}
갤러리 리스트
번호 말머리 제목 글쓴이 작성일 조회 추천
); }