Delete expense

This commit is contained in:
Sebastien Castiel
2023-12-06 15:08:52 -05:00
parent fee1963284
commit 570aa713b1
8 changed files with 104 additions and 16 deletions

View File

@@ -1,16 +1,16 @@
import { Button } from '@/components/ui/button'
import { Button, ButtonProps } from '@/components/ui/button'
import { Loader2 } from 'lucide-react'
import { PropsWithChildren, ReactNode } from 'react'
import { ReactNode } from 'react'
import { useFormState } from 'react-hook-form'
type Props = PropsWithChildren<{
type Props = {
loadingContent: ReactNode
}>
} & ButtonProps
export function SubmitButton({ children, loadingContent }: Props) {
export function SubmitButton({ children, loadingContent, ...props }: Props) {
const { isSubmitting } = useFormState()
return (
<Button type="submit" disabled={isSubmitting}>
<Button type="submit" disabled={isSubmitting} {...props}>
{isSubmitting ? (
<>
<Loader2 className="w-4 h-4 mr-2 animate-spin" /> {loadingContent}