import React from 'react'; import Tooltip from '@atlaskit/tooltip'; import Button from '@atlaskit/button/custom-theme-button'; import { getButtonStyles, iconOnlySpacing } from './styles'; export type ButtonAppearance = 'subtle' | 'danger'; export interface Props { title?: string; icon?: React.ReactElement; iconAfter?: React.ReactElement; onClick?: React.MouseEventHandler; onMouseEnter?: (event: React.MouseEvent) => void; onMouseLeave?: (event: React.MouseEvent) => void; selected?: boolean; disabled?: boolean; appearance?: ButtonAppearance; href?: string; target?: string; children?: React.ReactNode; className?: string; tooltipContent?: React.ReactNode; testId?: string; hideTooltipOnClick?: boolean; } export default ({ title, icon, iconAfter, onClick, onMouseEnter, onMouseLeave, selected, disabled, href, target, appearance = 'subtle', children, className, tooltipContent, testId, hideTooltipOnClick = true, }: Props) => { // Check if there's only an icon and add additional styles const iconOnly = (icon || iconAfter) && !children; const customSpacing = iconOnly ? iconOnlySpacing : {}; return (
); };