UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

32 lines 1.49 kB
import React from "react"; import { ArrowsCirclepathIcon, TrashIcon } from "@navikt/aksel-icons"; import { Button } from "../../../../button/index.js"; import Spacer from "../../../../layout/stack/Spacer.js"; import { Loader } from "../../../../loader/index.js"; function ItemActionField({ isLoading, button, translate, }) { if (isLoading) { return (React.createElement(React.Fragment, null, React.createElement(Spacer, null), React.createElement("div", { className: "aksel-file-item__icon--loading" }, React.createElement(Loader, { size: "medium" })))); } if (!button) { return null; } if (isCustomButton(button)) { return (React.createElement(React.Fragment, null, React.createElement(Spacer, null), button)); } const Icon = button.action === "delete" ? TrashIcon : ArrowsCirclepathIcon; return (React.createElement(React.Fragment, null, React.createElement(Spacer, null), React.createElement(Button, { id: button.id, className: "aksel-file-item__button", type: "button", variant: "tertiary-neutral", onClick: button.onClick, icon: React.createElement(Icon, { title: translate(button.action === "retry" ? "item.retryButtonTitle" : "item.deleteButtonTitle") }) }))); } function isCustomButton(button) { return React.isValidElement(button); } export { ItemActionField }; //# sourceMappingURL=ItemActionField.js.map