adds logic for preventDefault on Button
This commit is contained in:
@@ -19,8 +19,8 @@ const Button = (props) => {
|
||||
].filter(Boolean).join(' ');
|
||||
|
||||
function handleClick(event) {
|
||||
event.preventDefault();
|
||||
onClick();
|
||||
if (type !== 'submit' && onClick) event.preventDefault();
|
||||
if (onClick) onClick();
|
||||
}
|
||||
|
||||
const buttonProps = {
|
||||
@@ -53,8 +53,8 @@ const Button = (props) => {
|
||||
default:
|
||||
return (
|
||||
<button
|
||||
{...buttonProps}
|
||||
type="button"
|
||||
{...buttonProps}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
|
||||
@@ -11,7 +11,10 @@ const FormSubmit = ({ children }) => {
|
||||
const formContext = useContext(FormContext);
|
||||
return (
|
||||
<div className={baseClass}>
|
||||
<Button disabled={formContext.processing ? 'disabled' : ''}>
|
||||
<Button
|
||||
disabled={formContext.processing ? 'disabled' : ''}
|
||||
type="submit"
|
||||
>
|
||||
{children}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user