"use client"; import { useState } from "react"; import { Button, Dialog, DialogContent, DialogHeader, DialogTitle } from "@common/components"; import SidoSggFacilityNameSearchForm from "./SidoSggFacilityNameSearchForm"; import type { SearchFormValues } from "../type/SearchForm.type"; type GridTopActionButtonProps = { text: string; onClick?: (helpers: { openDialog: (title?: string) => void; closeDialog: () => void }) => void; /** 상위 화면 검색 통계연도 — 시설 조회 다이얼로그에 전달 */ statsYr?: string; /** 상위 화면 최근 검색조건 */ initialSearchValues?: Pick | null; /** 다이얼로그 저장 성공 후 부모 갱신 */ onSaveSuccess?: () => Promise | void; }; const GridTopActionButton = ({ text, onClick, statsYr, initialSearchValues, onSaveSuccess }: GridTopActionButtonProps) => { const [isOpen, setIsOpen] = useState(false); const [title, setTitle] = useState(text); const openDialog = (nextTitle?: string) => { setTitle(nextTitle ?? text); setIsOpen(true); }; const closeDialog = () => setIsOpen(false); const handleClick = () => { if (onClick) { onClick({ openDialog, closeDialog }); return; } openDialog(text); }; return ( <> {title} ); }; export default GridTopActionButton;