From: unknown Date: Thu, 2 Sep 2021 13:47:33 +0000 (+0530) Subject: Made tooltip optional in IconButton X-Git-Tag: v1.3.0^2~29 X-Git-Url: https://git.wafflesoft.org/?a=commitdiff_plain;h=6c1a602bdcf5cca2a07571b7bc1227af6effe006;p=cinny.git Made tooltip optional in IconButton --- diff --git a/src/app/atoms/button/IconButton.jsx b/src/app/atoms/button/IconButton.jsx index 34e2424..f92752e 100644 --- a/src/app/atoms/button/IconButton.jsx +++ b/src/app/atoms/button/IconButton.jsx @@ -16,11 +16,8 @@ import Text from '../text/Text'; const IconButton = React.forwardRef(({ variant, size, type, tooltip, tooltipPlacement, src, onClick, -}, ref) => ( - {tooltip}} - > +}, ref) => { + const btn = ( - -)); + ); + if (tooltip === null) return btn; + return ( + {tooltip}} + > + {btn} + + ); +}); IconButton.defaultProps = { variant: 'surface', size: 'normal', type: 'button', + tooltip: null, tooltipPlacement: 'top', onClick: null, }; @@ -45,7 +52,7 @@ IconButton.propTypes = { variant: PropTypes.oneOf(['surface']), size: PropTypes.oneOf(['normal', 'small', 'extra-small']), type: PropTypes.oneOf(['button', 'submit']), - tooltip: PropTypes.string.isRequired, + tooltip: PropTypes.string, tooltipPlacement: PropTypes.oneOf(['top', 'right', 'bottom', 'left']), src: PropTypes.string.isRequired, onClick: PropTypes.func,