import type { IconName, TooltipProps } from '@blueprintjs/core'; import { Icon, Tooltip } from '@blueprintjs/core'; import type { CSSProperties, ReactNode, SVGAttributes } from 'react'; interface IconButtonProps extends SVGAttributes { size?: number; padding?: number; icon?: IconName; backgroundColor?: CSSProperties['backgroundColor']; color?: CSSProperties['color']; title?: string; tooltipProps?: TooltipProps; renderIcon?: (props: Pick) => ReactNode; } export function SVGButton(props: IconButtonProps) { const { size = 16, padding = 5, className, icon, renderIcon, backgroundColor = 'gray', color = 'white', title, tooltipProps, ...otherProps } = props; const btnSize = size + padding; return ( {typeof renderIcon === 'function' ? ( renderIcon({ size: size - padding, color }) ) : ( )} ); }