From d28748616593801abd434b07524f63b33401089c Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Fri, 22 Oct 2021 17:13:57 +0530 Subject: [PATCH] Added button reset type. Signed-off-by: Ajay Bura --- src/app/atoms/button/Button.jsx | 5 +++-- src/app/atoms/button/IconButton.jsx | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/atoms/button/Button.jsx b/src/app/atoms/button/Button.jsx index bebca86..7fbf8c5 100644 --- a/src/app/atoms/button/Button.jsx +++ b/src/app/atoms/button/Button.jsx @@ -17,7 +17,8 @@ function Button({ className={`${className ? `${className} ` : ''}btn-${variant} ${iconClass} noselect`} onMouseUp={(e) => blurOnBubbling(e, `.btn-${variant}`)} onClick={onClick} - type={type === 'button' ? 'button' : 'submit'} + // eslint-disable-next-line react/button-has-type + type={type} disabled={disabled} > {iconSrc !== null && } @@ -42,7 +43,7 @@ Button.propTypes = { className: PropTypes.string, variant: PropTypes.oneOf(['surface', 'primary', 'positive', 'caution', 'danger']), iconSrc: PropTypes.string, - type: PropTypes.oneOf(['button', 'submit']), + type: PropTypes.oneOf(['button', 'submit', 'reset']), onClick: PropTypes.func, children: PropTypes.node.isRequired, disabled: PropTypes.bool, diff --git a/src/app/atoms/button/IconButton.jsx b/src/app/atoms/button/IconButton.jsx index 4ed2b93..f249f1b 100644 --- a/src/app/atoms/button/IconButton.jsx +++ b/src/app/atoms/button/IconButton.jsx @@ -17,7 +17,8 @@ const IconButton = React.forwardRef(({ className={`ic-btn ic-btn-${variant}`} onMouseUp={(e) => blurOnBubbling(e, `.ic-btn-${variant}`)} onClick={onClick} - type={type === 'button' ? 'button' : 'submit'} + // eslint-disable-next-line react/button-has-type + type={type} > @@ -45,7 +46,7 @@ IconButton.defaultProps = { IconButton.propTypes = { variant: PropTypes.oneOf(['surface', 'positive', 'caution', 'danger']), size: PropTypes.oneOf(['normal', 'small', 'extra-small']), - type: PropTypes.oneOf(['button', 'submit']), + type: PropTypes.oneOf(['button', 'submit', 'reset']), tooltip: PropTypes.string, tooltipPlacement: PropTypes.oneOf(['top', 'right', 'bottom', 'left']), src: PropTypes.string.isRequired,