@popsure/dirty-swan 0.27.5 → 0.27.6
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.
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/components/multiDropzone/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/lib/components/multiDropzone/icons/upload.svg +4 -4
- package/src/lib/components/multiDropzone/index.stories.mdx +21 -0
- package/src/lib/components/multiDropzone/index.tsx +17 -8
- package/src/lib/components/multiDropzone/style.module.scss +19 -14
|
@@ -14,6 +14,7 @@ interface Props {
|
|
|
14
14
|
uploadedFiles: UploadedFile[];
|
|
15
15
|
uploading: boolean;
|
|
16
16
|
onRemoveFile: (id: string) => void;
|
|
17
|
+
isCondensed?: boolean;
|
|
17
18
|
}
|
|
18
|
-
declare const _default: ({ uploadedFiles, onFileSelect, uploading, onRemoveFile, }: Props) => JSX.Element;
|
|
19
|
+
declare const _default: ({ uploadedFiles, onFileSelect, uploading, onRemoveFile, isCondensed, }: Props) => JSX.Element;
|
|
19
20
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<svg width="
|
|
2
|
-
<path d="
|
|
3
|
-
<path d="
|
|
4
|
-
<path d="
|
|
1
|
+
<svg width="70" height="70" viewBox="0 0 70 70" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M25.589 52.324H16.6368C12.2734 52.324 2.91699 48.3383 2.91699 38.0351C2.91699 26.9493 12.2734 23.2325 16.9623 23.2325C17.6018 17.8902 21.1291 7.97805 34.1238 7.29132C46.6242 7.29132 52.2035 18.5714 51.2854 26.9756C56.175 26.6729 67.0837 28.8787 67.0837 39.8558C67.0837 49.1926 57.3044 52.7417 52.4147 52.324H44.7121" stroke="#8E8CEE" stroke-width="3.08333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M35 63.2981V32.646" stroke="#8E8CEE" stroke-width="3.08333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M27.3428 40.3045L35.0013 32.646L42.6599 40.3045" stroke="#8E8CEE" stroke-width="3.08333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
5
|
</svg>
|
|
@@ -69,6 +69,27 @@ MultiDropzone component allows upload of multiple documents / files.
|
|
|
69
69
|
/>
|
|
70
70
|
</Preview>
|
|
71
71
|
|
|
72
|
+
### Condensed view
|
|
73
|
+
|
|
74
|
+
<Preview>
|
|
75
|
+
<MultiDropzone
|
|
76
|
+
uploadedFiles={[
|
|
77
|
+
{
|
|
78
|
+
id: '123',
|
|
79
|
+
type: 'pdf',
|
|
80
|
+
progress: '100',
|
|
81
|
+
name: 'test_file_name.pdf',
|
|
82
|
+
token: 'abc',
|
|
83
|
+
previewUrl: 'http://getpopsure.com/test_file_name.pdf',
|
|
84
|
+
},
|
|
85
|
+
]}
|
|
86
|
+
onFileSelect={() => {}}
|
|
87
|
+
uploading={false}
|
|
88
|
+
onRemoveFile={() => {}}
|
|
89
|
+
isCondensed
|
|
90
|
+
/>
|
|
91
|
+
</Preview>
|
|
92
|
+
|
|
72
93
|
### Error state
|
|
73
94
|
|
|
74
95
|
<Preview>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
2
|
import { useDropzone } from 'react-dropzone';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
|
|
@@ -44,6 +44,7 @@ interface Props {
|
|
|
44
44
|
uploadedFiles: UploadedFile[];
|
|
45
45
|
uploading: boolean;
|
|
46
46
|
onRemoveFile: (id: string) => void;
|
|
47
|
+
isCondensed?: boolean;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export default ({
|
|
@@ -51,6 +52,7 @@ export default ({
|
|
|
51
52
|
onFileSelect,
|
|
52
53
|
uploading,
|
|
53
54
|
onRemoveFile,
|
|
55
|
+
isCondensed = false,
|
|
54
56
|
}: Props) => {
|
|
55
57
|
const onDrop = useCallback(
|
|
56
58
|
(acceptedFiles) => {
|
|
@@ -62,16 +64,23 @@ export default ({
|
|
|
62
64
|
const { getRootProps, getInputProps } = useDropzone({ onDrop });
|
|
63
65
|
|
|
64
66
|
return (
|
|
65
|
-
<div className={
|
|
67
|
+
<div className={styles.container}>
|
|
66
68
|
<div
|
|
67
|
-
className={classnames(
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
className={classnames(
|
|
70
|
+
`w100 ta-center br8 c-pointer ${styles.dropzoneContainer}`,
|
|
71
|
+
{
|
|
72
|
+
[styles['dropzoneContainerDisabled']]: uploading,
|
|
73
|
+
}
|
|
74
|
+
)}
|
|
70
75
|
{...getRootProps()}
|
|
71
76
|
>
|
|
72
77
|
<input {...getInputProps()} />
|
|
73
|
-
<img
|
|
74
|
-
|
|
78
|
+
<img
|
|
79
|
+
className={isCondensed ? styles.img : ''}
|
|
80
|
+
src={icons.uploadIcon}
|
|
81
|
+
alt="purple cloud with an arrow"
|
|
82
|
+
/>
|
|
83
|
+
<div className={`p-h4 mt8 ${isCondensed ? styles.textInline : ''}`}>
|
|
75
84
|
{uploading
|
|
76
85
|
? 'Please wait while uploading file...'
|
|
77
86
|
: 'Choose file or drag & drop'}
|
|
@@ -79,7 +88,7 @@ export default ({
|
|
|
79
88
|
<div className="p-p--small tc-grey-500">Supports JPEG, PNG, PDF</div>
|
|
80
89
|
</div>
|
|
81
90
|
{uploadedFiles.length > 0 && (
|
|
82
|
-
<div className=
|
|
91
|
+
<div className="w100 mt16">
|
|
83
92
|
{uploadedFiles.map((file) => {
|
|
84
93
|
const uploadStatus = getUploadStatus(file.progress, file.error);
|
|
85
94
|
return (
|
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
@use "../../scss/public/grid" as *;
|
|
2
2
|
|
|
3
3
|
.container {
|
|
4
|
-
background-color:
|
|
5
|
-
padding: 24px;
|
|
6
|
-
box-shadow: 0px 2px 3px rgba(38, 38, 46, 0.04);
|
|
7
|
-
border-radius: 8px;
|
|
8
|
-
|
|
9
|
-
@include p-size-mobile {
|
|
10
|
-
padding: 16px;
|
|
11
|
-
}
|
|
4
|
+
background-color: transparent;
|
|
12
5
|
}
|
|
13
6
|
|
|
14
|
-
.
|
|
7
|
+
.dropzoneContainer {
|
|
15
8
|
border: 1px dashed var(--ds-primary-500);
|
|
16
9
|
padding: 32px 0;
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
background-color: white;
|
|
11
|
+
|
|
12
|
+
transition: all 0.6s ease-in-out;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.img {
|
|
16
|
+
vertical-align: middle;
|
|
17
|
+
margin-right: 8px;
|
|
18
|
+
height: 18px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.textInline {
|
|
22
|
+
display: inline-flex;
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
.
|
|
25
|
+
.dropzoneContainer:focus {
|
|
22
26
|
outline: none;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
|
-
.
|
|
29
|
+
.dropzoneContainer:hover {
|
|
26
30
|
background-color: var(--ds-primary-100);
|
|
27
31
|
transition: 0.5s ease;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
.
|
|
34
|
+
.dropzoneContainerDisabled {
|
|
31
35
|
pointer-events: none;
|
|
36
|
+
opacity: 0.4
|
|
32
37
|
}
|