ywana-core8 0.0.875 → 0.0.876

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.875",
3
+ "version": "0.0.876",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -26,7 +26,7 @@ const UploadProgressTest = (prop) => {
26
26
  const UploaderTest = (prop) => {
27
27
  return (
28
28
  <div style={{ padding: "1rem" }}>
29
- <Uploader icon="cloud_upload" target="https://maso.developxp.com/kiosk/api/upload" />
29
+ <Uploader view="icon" icon="cloud_upload" target="https://maso.developxp.com/kiosk/api/upload" />
30
30
  </div>
31
31
  )
32
32
  }
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useMemo } from 'react'
2
2
  import ResumableJS from 'resumablejs'
3
- import { UploadArea } from "./UploadArea";
3
+ import { UploadArea, UploadIcon } from "./UploadArea";
4
4
  import { UploadProgress } from './UploadProgress';
5
5
  import { UPLOAD_STATES } from './UploadStates';
6
6
  import './Uploader.css'
@@ -9,7 +9,7 @@ import './Uploader.css'
9
9
  /**
10
10
  * Uploader
11
11
  */
12
- export const Uploader = ({ icon, label, target, accept, simultaneousUploads = 1, className, onProgress, onSuccess, onError, onComplete }) => {
12
+ export const Uploader = ({ icon, label, view="area", target, accept, simultaneousUploads = 1, className, onProgress, onSuccess, onError, onComplete }) => {
13
13
 
14
14
  const resumable = useMemo(() => {
15
15
  const config = {
@@ -63,9 +63,19 @@ export const Uploader = ({ icon, label, target, accept, simultaneousUploads = 1,
63
63
  if (onComplete) onComplete(files)
64
64
  }
65
65
 
66
+ function renderView() {
67
+ switch (view) {
68
+ case "area": return <UploadArea resumable={resumable} icon={icon} label={label} />
69
+ case "icon": return <UploadIcon resumable={resumable} icon={icon} />
70
+ default: return <UploadArea resumable={resumable} icon={icon} label={label} />
71
+ }
72
+ }
73
+
66
74
  return (
67
75
  <div className={`uploader ${className}`}>
68
- {state === UPLOAD_STATES.IDLE ? <UploadArea resumable={resumable} icon={icon} label={label} /> : <UploadProgress files={files} /> }
76
+ {state === UPLOAD_STATES.IDLE ? renderView() : <UploadProgress files={files} /> }
69
77
  </div>
70
78
  )
71
79
  }
80
+
81
+