import { useRef } from "react"; import type { IconComponent } from "@/components/icons"; /** A toolbar button that opens its own file picker. */ export default function MediaButton({ accept, multiple = false, label, hint, Icon, disabled, onFiles, }: { accept: string; multiple?: boolean; label: string; hint: string; Icon: IconComponent; disabled: boolean; onFiles: (files: File[]) => void; }) { const input = useRef(null); return ( <> { const files = Array.from(event.target.files || []); event.target.value = ""; onFiles(files); }} /> ); }