Added button reset type.
authorAjay Bura <ajbura@gmail.com>
Fri, 22 Oct 2021 11:43:57 +0000 (17:13 +0530)
committerAjay Bura <ajbura@gmail.com>
Fri, 22 Oct 2021 11:43:57 +0000 (17:13 +0530)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
src/app/atoms/button/Button.jsx
src/app/atoms/button/IconButton.jsx

index bebca86153020f139534c432750697f0171ca414..7fbf8c5753b4d24c0bd1d5d8098d5a9ca599dfa2 100644 (file)
@@ -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 && <RawIcon size="small" src={iconSrc} />}
@@ -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,
index 4ed2b930eb33b9a3c87d60053d21a73a57d447b3..f249f1b0cef03a29e448053b5905ad2ac7ec6fc4 100644 (file)
@@ -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}
     >
       <RawIcon size={size} src={src} />
     </button>
@@ -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,