import React, { MouseEvent } from "react"; import { ArrowsCirclepathIcon, TrashIcon } from "@navikt/aksel-icons"; import { Button } from "../../../button"; import { Loader } from "../../../loader"; import { Spacer } from "../../../primitives/stack"; import type { TFunction } from "../../../utils/i18n/i18n.types"; interface ItemActionFieldProps { isLoading: boolean; button?: | { action: "delete" | "retry"; onClick: (event: MouseEvent) => void; id?: string; } | React.ReactNode; translate: TFunction<"FileUpload">; } function ItemActionField({ isLoading, button, translate, }: ItemActionFieldProps) { if (isLoading) { return ( <>
); } if (!button) { return null; } if (isCustomButton(button)) { return ( <> {button} ); } const Icon = button.action === "delete" ? TrashIcon : ArrowsCirclepathIcon; return ( <>