sendou.ink/app/components/SubmitButton.tsx
Kalle 6feb269193
Full tournament feature WIP (#1196)
* Layout initial

* Add FillRosterSection component

* Move tournaments to feature folder

* Refactor Button props

* SubmitButton

* Register action

* Identifier -> Id

* Invite link via nanoid

* Team info submit

* Enter tiebreaker map list UI

* Invite members to tournament team initial

* Show banner if joined a team not captain of

* Add back teams page

* Change team roster size color when good

* Delete tournament team member
2022-12-21 23:24:59 +02:00

31 lines
668 B
TypeScript

import { type FetcherWithComponents, useTransition } from "@remix-run/react";
import { Button, type ButtonProps } from "./Button";
interface SubmitButtonProps extends ButtonProps {
state?: FetcherWithComponents<any>["state"];
_action?: string;
}
export function SubmitButton({
children,
state,
_action,
...rest
}: SubmitButtonProps) {
const transition = useTransition();
const isSubmitting = state ? state !== "idle" : transition.state !== "idle";
return (
<Button
{...rest}
disabled={isSubmitting}
type="submit"
name={_action ? "_action" : undefined}
value={_action}
>
{children}
</Button>
);
}