mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
add isSubmitting state to BeerForm
This commit is contained in:
@@ -3,11 +3,19 @@ import { FunctionComponent } from 'react';
|
||||
interface FormButtonProps {
|
||||
children: string;
|
||||
type: 'button' | 'submit' | 'reset';
|
||||
isSubmitting?: boolean;
|
||||
}
|
||||
|
||||
const Button: FunctionComponent<FormButtonProps> = ({ children, type }) => (
|
||||
const Button: FunctionComponent<FormButtonProps> = ({
|
||||
children,
|
||||
type,
|
||||
isSubmitting = false,
|
||||
}) => (
|
||||
// eslint-disable-next-line react/button-has-type
|
||||
<button type={type} className="btn-primary btn mt-4 w-full rounded-xl">
|
||||
<button
|
||||
type={type}
|
||||
className={`btn btn-primary mt-4 w-full rounded-xl ${isSubmitting ? 'loading' : ''}`}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user