UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

63 lines 1.61 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import React from 'react'; import classNames from 'classnames'; import Anchor from "../../components/Anchor.js"; import Button from "../button/Button.js"; import Span from "../../elements/Span.js"; import { createSpacingClasses } from "../space/SpacingUtils.js"; export const UploadFileLink = props => { const { onClick, text, href, download, ...rest } = props; if (!onClick && !href) { return React.createElement(Span, _extends({ className: "dnb-p" }, rest), text); } if (onClick) { return React.createElement(UploadFileButton, _extends({ text: text, onClick: onClick }, rest)); } return React.createElement(UploadFileAnchor, _extends({ text: text, href: href, download: download }, rest)); }; export default UploadFileLink; const UploadFileButton = props => { const { text, onClick } = props; const spacingClasses = createSpacingClasses(props); return React.createElement(Button, { size: "small", icon: false, variant: "tertiary", onClick: onClick, className: classNames(spacingClasses) }, text); }; const UploadFileAnchor = props => { const { text, href, download } = props; const spacingClasses = createSpacingClasses(props); return React.createElement(Anchor, { target: "_blank", href: href, download: download ? text : null, className: classNames('dnb-anchor--no-launch-icon', spacingClasses), rel: "noopener noreferrer" }, text); }; //# sourceMappingURL=UploadFileListLink.js.map