import { useState } from 'react';

export default function Dropdown({ button, children }) {
    const [isOpen, setIsOpen] = useState(false);

    return (
        <div className="dropdown">
            <button
                className="btn btn-link dropdown-toggle text-decoration-none"
                type="button"
                onClick={() => setIsOpen(!isOpen)}
                aria-expanded={isOpen}
            >
                {button}
            </button>
            {isOpen && (
                <ul className="dropdown-menu show">
                    {children}
                </ul>
            )}
        </div>
    );
}
