@react-magma/dropzone 0.1.4 → 1.0.0-next.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.
@@ -24,55 +24,55 @@ const icons = {
24
24
  default: {
25
25
  Icon: InsertDriveFileIcon,
26
26
  style: {
27
- color: '#707070',
27
+ color: magma.colors.neutral500,
28
28
  },
29
29
  },
30
30
  word: {
31
31
  Icon: FileWordIcon,
32
32
  style: {
33
- color: '#006298',
33
+ color: magma.colors.info500,
34
34
  },
35
35
  },
36
36
  excel: {
37
37
  Icon: FileExcelIcon,
38
38
  style: {
39
- color: '#3A8200',
39
+ color: magma.colors.success500,
40
40
  },
41
41
  },
42
42
  powerpoint: {
43
43
  Icon: FilePowerpointIcon,
44
44
  style: {
45
- color: '#FC4C02',
45
+ color: magma.colors.warning500,
46
46
  },
47
47
  },
48
48
  pdf: {
49
49
  Icon: FilePdfIcon,
50
50
  style: {
51
- color: '#C61D23',
51
+ color: magma.colors.danger500,
52
52
  },
53
53
  },
54
54
  image: {
55
55
  Icon: ImageIcon,
56
56
  style: {
57
- color: '#707070',
57
+ color: magma.colors.neutral500,
58
58
  },
59
59
  },
60
60
  video: {
61
61
  Icon: VideocamIcon,
62
62
  style: {
63
- color: '#707070',
63
+ color: magma.colors.neutral500,
64
64
  },
65
65
  },
66
66
  audio: {
67
67
  Icon: AudiotrackIcon,
68
68
  style: {
69
- color: '#707070',
69
+ color: magma.colors.neutral500,
70
70
  },
71
71
  },
72
72
  archive: {
73
73
  Icon: FileZipIcon,
74
74
  style: {
75
- color: '#707070',
75
+ color: magma.colors.neutral500,
76
76
  },
77
77
  },
78
78
  };
@@ -1,9 +1,4 @@
1
- import React, {
2
- forwardRef,
3
- useContext,
4
- useEffect,
5
- useState,
6
- } from 'react';
1
+ import React, { forwardRef, useContext, useEffect, useState } from 'react';
7
2
 
8
3
  import {
9
4
  CheckCircleIcon,
@@ -103,15 +98,14 @@ const FileName = styled(Flex)`
103
98
  `;
104
99
 
105
100
  const StyledCard = styled(Card)<{ file: FilePreview; isInverse: boolean }>`
106
- background-color: ${({ isInverse, theme }) =>
107
- isInverse ? theme.colors.foundation02 : theme.colors.neutral08};
101
+ background-color: none;
108
102
  border-color: ${({ file, theme, isInverse }) =>
109
103
  file.errors
110
104
  ? isInverse
111
105
  ? theme.colors.dangerInverse
112
106
  : theme.colors.danger
113
107
  : theme.colors.neutral06};
114
- border-width: ${({ file }) => (file.errors ? '2px' : '1px')};
108
+ border-width: 1px;
115
109
  margin: 10px 0;
116
110
  `;
117
111
 
@@ -149,12 +143,20 @@ const formatError = (
149
143
  case 'file-too-large':
150
144
  return {
151
145
  ...error,
152
- message: `${error.message} ${formatFileSize(constraints.maxSize, 2, byteLabel)}.`,
146
+ message: `${error.message} ${formatFileSize(
147
+ constraints.maxSize,
148
+ 2,
149
+ byteLabel
150
+ )}.`,
153
151
  };
154
152
  case 'file-too-small':
155
153
  return {
156
154
  ...error,
157
- message: `${error.message} ${formatFileSize(constraints.minSize, 2, byteLabel)}.`,
155
+ message: `${error.message} ${formatFileSize(
156
+ constraints.minSize,
157
+ 2,
158
+ byteLabel
159
+ )}.`,
158
160
  };
159
161
  case 'file-invalid-type':
160
162
  return { ...error, message: `${error.message}: ${messageSuffix}` };
@@ -197,7 +199,7 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
197
199
  useEffect(() => {
198
200
  let mounted = true;
199
201
  setTimeout(() => {
200
- if(mounted) {
202
+ if (mounted) {
201
203
  setDone(true);
202
204
  }
203
205
  }, 1000);
@@ -224,9 +226,7 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
224
226
  return (
225
227
  <StatusIcons>
226
228
  <Spinner
227
- color={
228
- isInverse ? theme.colors.foundation04 : theme.colors.primary
229
- }
229
+ color={isInverse ? theme.colors.neutral100 : theme.colors.primary}
230
230
  />
231
231
  </StatusIcons>
232
232
  );
@@ -236,9 +236,7 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
236
236
  <StatusIcons>
237
237
  <Transition isOpen={!done} unmountOnExit fade>
238
238
  <CheckCircleIcon
239
- color={
240
- isInverse ? theme.colors.successInverse : theme.colors.success
241
- }
239
+ color={isInverse ? theme.colors.success200 : theme.colors.success}
242
240
  style={{ marginTop: '4px' }}
243
241
  />
244
242
  </Transition>
@@ -283,7 +281,7 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
283
281
  {file.errors ? (
284
282
  <ErrorIcon
285
283
  color={
286
- isInverse ? theme.colors.dangerInverse : theme.colors.danger
284
+ isInverse ? theme.colors.danger200 : theme.colors.danger
287
285
  }
288
286
  size={24}
289
287
  />
@@ -299,9 +297,15 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
299
297
  <FileName xs behavior={FlexBehavior.item} theme={theme}>
300
298
  {file.name}
301
299
  </FileName>
302
- {file.processor && file.processor.status === 'pending' && <Flex role="progressbar" style={{ marginLeft: 'auto' }} behavior={FlexBehavior.item}>
303
- {file.processor.percent}
304
- </Flex>}
300
+ {file.processor && file.processor.status === 'pending' && (
301
+ <Flex
302
+ role="progressbar"
303
+ style={{ marginLeft: 'auto' }}
304
+ behavior={FlexBehavior.item}
305
+ >
306
+ {file.processor.percent}
307
+ </Flex>
308
+ )}
305
309
  <Flex behavior={FlexBehavior.item}>{actions}</Flex>
306
310
  </StyledFlex>
307
311
  {file.errors && (
@@ -317,7 +321,7 @@ export const Preview = forwardRef<HTMLDivElement, PreviewProps>(
317
321
  <ErrorHeader
318
322
  style={{
319
323
  color: isInverse
320
- ? theme.colors.dangerInverse
324
+ ? theme.colors.danger200
321
325
  : theme.colors.danger,
322
326
  }}
323
327
  >