import React from 'react'; import { Ellipsis } from '../Ellipsis'; import { Typography } from '../Typography'; import { ButtonBox, ButtonStyled, IconBox } from './Button.styled'; import { ButtonProps } from './types'; export { ButtonProps } from './types'; export const Button: React.FunctionComponent = ({ type, onClick, borderColorToken, backgroundColorToken, typographyColorToken, rounded, loading = false, children, disabled = false, disabledTextColorToken, disabledBackgroundColorToken, bottomLeftText, className, 'data-testid': dataTestId, bottomLeftTextColorToken = 'white400', typographyToken = 'bodyMediumBold', bottomLeftTextTypographyToken = 'bodyXSmallMedium', hoverBorderColorToken, hoverTypographyColorToken, hoverBackgroundColorToken, iconLeft, iconRight, hoverIconColorToken = hoverTypographyColorToken, iconColorToken = typographyColorToken, whiteSpace = 'normal', onMouseDown, }) => { const childrenToRender = !loading ? children : ; const content = ( <> {iconLeft && !loading && ( {iconLeft} )} {childrenToRender} {iconRight && !loading && ( {iconRight} )} ); const button = ( {content} ); if (!bottomLeftText) { return button; } return ( {button} {bottomLeftText} ); };