import { useRef } from 'react';
import { Button } from 'primereact/button';
import { Menu } from 'primereact/menu';

export interface SettingsMenuItem {
    label: string;
    icon?: string;
    command?: () => void;
}

interface SettingsMenuProps {
    items: SettingsMenuItem[];
    buttonClassName?: string;
}

const SettingsMenu: React.FC<SettingsMenuProps> = ({ items, buttonClassName }) => {
    const menuRef = useRef<any>(null);

    return (
        <>
            <Button
                icon="pi pi-cog"
                aria-label="Settings"
                onClick={e => menuRef.current.toggle(e)}
                className={buttonClassName || ''}
                tooltip="Settings"
            />
            <Menu
                model={items}
                popup
                ref={menuRef}
            />
        </>
    );
};

export default SettingsMenu; 