Files
prowler/ui/components/scans/button-refresh-data.tsx
T
2024-11-25 13:15:14 +01:00

31 lines
635 B
TypeScript

"use client";
import { RefreshCcwIcon } from "lucide-react";
import { useTransition } from "react";
import { CustomButton } from "../ui/custom";
export const ButtonRefreshData = ({
onPress,
}: {
onPress: () => Promise<void>;
}) => {
const [isPending, startTransition] = useTransition();
return (
<CustomButton
ariaLabel="Refresh scan page"
variant="solid"
color="action"
size="md"
endContent={!isPending && <RefreshCcwIcon size={24} />}
isLoading={isPending}
onPress={() => {
startTransition(async () => {
await onPress();
});
}}
/>
);
};