You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
935 B
TypeScript
33 lines
935 B
TypeScript
// frontend/components/connectors/ImportDropzone.tsx — CSV/.ics/HealthKit 수동 임포트
|
|
"use client";
|
|
import { useRef } from "react";
|
|
import { Icon } from "@/components/Icon";
|
|
|
|
export function ImportDropzone({ onImport }: { onImport: (file: File) => void }) {
|
|
const ref = useRef<HTMLInputElement>(null);
|
|
|
|
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
const file = e.target.files?.[0];
|
|
if (file) onImport(file);
|
|
// 같은 파일 재선택 허용
|
|
e.target.value = "";
|
|
};
|
|
|
|
return (
|
|
<div className="cn-dropzone">
|
|
<input
|
|
ref={ref}
|
|
type="file"
|
|
aria-label="파일 가져오기"
|
|
accept=".csv,.ics,.xml"
|
|
className="cn-file"
|
|
onChange={onChange}
|
|
/>
|
|
<button type="button" className="cn-btn cn-ghost" onClick={() => ref.current?.click()}>
|
|
<Icon name="upload" />
|
|
파일 가져오기
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|