import clsx from 'clsx' import { Dispatch, SetStateAction, useRef } from 'react' import { ButtonPopupProps } from '@dao-dao/types' import { Button } from '../buttons' import { Popup } from './Popup' export const ButtonPopup = ({ sectionClassName, sections, ButtonLink, ...props }: ButtonPopupProps) => { const setOpenRef = useRef> | null>(null) return ( {sections.map(({ label, buttons }, index) => (
0 && 'border-t border-border-secondary', sectionClassName )} > {label &&

{label}

} {buttons.map( ( { Icon, label, loading, closeOnClick = true, pressed, ...buttonProps }, index ) => { const content = ( <> {Icon && (
)}

{label}

) const commonProps = { key: index, pressed, // eslint-disable-next-line i18next/no-literal-string contentContainerClassName: 'gap-2', // eslint-disable-next-line i18next/no-literal-string variant: 'ghost', } as const return 'onClick' in buttonProps ? ( ) : ( //! 'href' in props { if (closeOnClick) { setOpenRef.current?.(false) } }} > {content} ) } )}
))}
) }