@uncinc/uncinc-react-kitchen-sink 2.24.0 → 2.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,20 +8,37 @@ import React from 'react';
|
|
|
8
8
|
import c from 'classnames';
|
|
9
9
|
import prettyBytes from 'pretty-bytes';
|
|
10
10
|
import Icon from '../Icon';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
className
|
|
11
|
+
import Image from '../Image';
|
|
12
|
+
var DownloadIcon = function DownloadIcon(_ref) {
|
|
13
|
+
var materialIconName = _ref.materialIconName,
|
|
14
|
+
mimeType = _ref.mimeType,
|
|
15
|
+
mimeSubType = _ref.mimeSubType;
|
|
16
|
+
if (materialIconName) {
|
|
17
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
18
|
+
className: "Download__icon Icon-".concat(mimeType, " Icon-").concat(mimeSubType),
|
|
19
|
+
name: materialIconName,
|
|
20
|
+
flair: "outlined"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
24
|
+
className: "Download__icon icon icon-download icon-".concat(mimeType, " icon-").concat(mimeSubType)
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
var Download = function Download(_ref2) {
|
|
28
|
+
var source = _ref2.source,
|
|
29
|
+
title = _ref2.title,
|
|
30
|
+
image = _ref2.image,
|
|
31
|
+
_ref2$description = _ref2.description,
|
|
32
|
+
description = _ref2$description === void 0 ? null : _ref2$description,
|
|
33
|
+
_ref2$filesize = _ref2.filesize,
|
|
34
|
+
filesize = _ref2$filesize === void 0 ? null : _ref2$filesize,
|
|
35
|
+
_ref2$filename = _ref2.filename,
|
|
36
|
+
filename = _ref2$filename === void 0 ? '' : _ref2$filename,
|
|
37
|
+
materialIconName = _ref2.materialIconName,
|
|
38
|
+
mime = _ref2.mime,
|
|
39
|
+
_ref2$target = _ref2.target,
|
|
40
|
+
target = _ref2$target === void 0 ? '_self' : _ref2$target,
|
|
41
|
+
className = _ref2.className;
|
|
25
42
|
var classes = c('Download', className);
|
|
26
43
|
var _mime$split = mime.split('/'),
|
|
27
44
|
_mime$split2 = _slicedToArray(_mime$split, 2),
|
|
@@ -33,12 +50,20 @@ var Download = function Download(_ref) {
|
|
|
33
50
|
target: target,
|
|
34
51
|
href: source,
|
|
35
52
|
rel: "noreferrer"
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
className: "
|
|
53
|
+
}, image ?
|
|
54
|
+
/*#__PURE__*/
|
|
55
|
+
// Thumbnail image is decorative: alt="" hides it from screen readers
|
|
56
|
+
// role="presentation" removes any implicit role from the element
|
|
57
|
+
React.createElement("div", {
|
|
58
|
+
className: "Download__image"
|
|
59
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
60
|
+
src: image,
|
|
61
|
+
alt: "",
|
|
62
|
+
role: "presentation"
|
|
63
|
+
})) : /*#__PURE__*/React.createElement(DownloadIcon, {
|
|
64
|
+
materialIconName: materialIconName,
|
|
65
|
+
mimeType: mimeType,
|
|
66
|
+
mimeSubType: mimeSubType
|
|
42
67
|
}), /*#__PURE__*/React.createElement("div", {
|
|
43
68
|
className: "Download__content"
|
|
44
69
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -51,6 +76,10 @@ var Download = function Download(_ref) {
|
|
|
51
76
|
className: "Download__extension"
|
|
52
77
|
}, extension[0], "\xA0"), filesize && /*#__PURE__*/React.createElement("span", {
|
|
53
78
|
className: "Download__filesize"
|
|
54
|
-
}, "(", prettyBytes(filesize), ")"))
|
|
79
|
+
}, "(", prettyBytes(filesize), ")")), image && /*#__PURE__*/React.createElement(DownloadIcon, {
|
|
80
|
+
materialIconName: materialIconName,
|
|
81
|
+
mimeType: mimeType,
|
|
82
|
+
mimeSubType: mimeSubType
|
|
83
|
+
}));
|
|
55
84
|
};
|
|
56
85
|
export default Download;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DownloadProps } from '../../components/Download';
|
|
3
|
+
export interface LinkProps {
|
|
4
|
+
href: string;
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
3
7
|
export interface DownloadsProps {
|
|
4
8
|
title?: string;
|
|
5
9
|
text?: string;
|
|
6
10
|
downloads: DownloadProps[];
|
|
7
11
|
target?: HTMLAnchorElement['target'];
|
|
8
12
|
materialIconName?: string;
|
|
13
|
+
links?: LinkProps[];
|
|
9
14
|
className?: string;
|
|
10
15
|
}
|
|
11
16
|
declare const Downloads: React.FC<DownloadsProps>;
|
|
@@ -2,25 +2,37 @@ import React from 'react';
|
|
|
2
2
|
import c from 'classnames';
|
|
3
3
|
import Download from '../../components/Download';
|
|
4
4
|
import TitleWithText from '../../components/TitleWithText';
|
|
5
|
+
import Button from '../../components/Button';
|
|
5
6
|
var Downloads = function Downloads(_ref) {
|
|
6
7
|
var title = _ref.title,
|
|
7
8
|
text = _ref.text,
|
|
8
9
|
downloads = _ref.downloads,
|
|
9
10
|
target = _ref.target,
|
|
10
11
|
materialIconName = _ref.materialIconName,
|
|
11
|
-
className = _ref.className
|
|
12
|
+
className = _ref.className,
|
|
13
|
+
links = _ref.links;
|
|
12
14
|
var classes = c('Downloads', className);
|
|
13
15
|
return /*#__PURE__*/React.createElement("div", {
|
|
14
16
|
className: classes
|
|
15
17
|
}, /*#__PURE__*/React.createElement(TitleWithText, {
|
|
16
18
|
title: title,
|
|
17
19
|
text: text
|
|
18
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
}), links && links.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "Downloads__links"
|
|
22
|
+
}, links.map(function (link) {
|
|
23
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
24
|
+
primary: false,
|
|
25
|
+
className: "Downloads__link",
|
|
26
|
+
href: link.href
|
|
27
|
+
}, link.title);
|
|
28
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
19
29
|
className: "Downloads__files"
|
|
20
30
|
}, downloads.map(function (download) {
|
|
21
31
|
return /*#__PURE__*/React.createElement(Download, {
|
|
32
|
+
key: download.source,
|
|
22
33
|
source: download.source,
|
|
23
34
|
title: download.title,
|
|
35
|
+
image: download.image,
|
|
24
36
|
description: download.description,
|
|
25
37
|
filesize: download.filesize,
|
|
26
38
|
filename: download.filename,
|