mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 17:09:09 +01:00
Refactor desktop app into separate client and proxy apps
This commit is contained in:
25
apps/yaak-client/components/core/ButtonInfiniteLoading.tsx
Normal file
25
apps/yaak-client/components/core/ButtonInfiniteLoading.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { useState } from 'react';
|
||||
import type { ButtonProps } from './Button';
|
||||
import { Button } from './Button';
|
||||
|
||||
export function ButtonInfiniteLoading({
|
||||
onClick,
|
||||
isLoading,
|
||||
loadingChildren,
|
||||
children,
|
||||
...props
|
||||
}: ButtonProps & { loadingChildren?: string }) {
|
||||
const [localIsLoading, setLocalIsLoading] = useState<boolean>(false);
|
||||
return (
|
||||
<Button
|
||||
isLoading={localIsLoading || isLoading}
|
||||
onClick={(e) => {
|
||||
setLocalIsLoading(true);
|
||||
onClick?.(e);
|
||||
}}
|
||||
{...props}
|
||||
>
|
||||
{localIsLoading ? (loadingChildren ?? children) : children}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user