Files
nextjs-server-fetching/examples/data-fetching/src/modules/common/components/loading-button/loading-button.component.tsx
2024-01-15 23:13:55 +01:00

17 lines
464 B
TypeScript

import React, { ComponentPropsWithRef } from 'react'
import { Button } from '../ui/button'
import { Icons } from '../icons'
export function LoadingButton({
loading,
children,
...props
}: ComponentPropsWithRef<typeof Button> & { loading?: boolean }) {
return (
<Button {...props} data-testid="loading-button">
{loading && <Icons.spinner className="animate-spin w-8 h-8 mr-2" />}
{children}
</Button>
)
}