@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
68 lines • 1.41 kB
JavaScript
import React from 'react';
import Anchor from "../../components/Anchor.js";
import Button from "../button/Button.js";
import Span from "../../elements/Span.js";
import { applySpacing } from "../space/SpacingUtils.js";
import { jsx as _jsx } from "react/jsx-runtime";
export const UploadFileLink = props => {
const {
onClick,
text,
href,
download,
...rest
} = props;
if (!onClick && !href) {
return _jsx(Span, {
className: "dnb-p",
...rest,
children: text
});
}
if (onClick) {
return _jsx(UploadFileButton, {
text: text,
onClick: onClick,
...rest
});
}
return _jsx(UploadFileAnchor, {
text: text,
href: href,
download: download,
...rest
});
};
export default UploadFileLink;
const UploadFileButton = props => {
const {
text,
onClick
} = props;
return _jsx(Button, {
size: "small",
icon: false,
variant: "tertiary",
onClick: onClick,
...applySpacing(props, {}),
children: text
});
};
const UploadFileAnchor = props => {
const {
text,
href,
download
} = props;
return _jsx(Anchor, {
target: "_blank",
href: href,
download: download ? text : null,
...applySpacing(props, {
className: 'dnb-anchor--no-launch-icon'
}),
rel: "noopener noreferrer",
children: text
});
};
//# sourceMappingURL=UploadFileListLink.js.map