{"id":13632531,"url":"https://github.com/cheersmas/react-upload-box","last_synced_at":"2025-04-18T02:33:27.946Z","repository":{"id":47958203,"uuid":"279966552","full_name":"cheersmas/react-upload-box","owner":"cheersmas","description":"A minimal Upload component for React.","archived":true,"fork":false,"pushed_at":"2021-08-11T13:28:02.000Z","size":2207,"stargazers_count":181,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-26T14:41:43.627Z","etag":null,"topics":["progress-bar","react","upload"],"latest_commit_sha":null,"homepage":"https://cheersmas.github.io/react-upload-box","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheersmas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-15T20:06:57.000Z","updated_at":"2024-02-23T08:54:30.000Z","dependencies_parsed_at":"2022-09-13T02:23:01.627Z","dependency_job_id":null,"html_url":"https://github.com/cheersmas/react-upload-box","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheersmas%2Freact-upload-box","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheersmas%2Freact-upload-box/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheersmas%2Freact-upload-box/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheersmas%2Freact-upload-box/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheersmas","download_url":"https://codeload.github.com/cheersmas/react-upload-box/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249414253,"owners_count":21267724,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["progress-bar","react","upload"],"created_at":"2024-08-01T22:03:06.006Z","updated_at":"2025-04-18T02:33:27.665Z","avatar_url":"https://github.com/cheersmas.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# React Upload Box\n\n\u003cdiv align=\"center\"\u003e\n  \u003cdiv\u003e\n    \u003cimg src=\"./readme-assets/upload.gif\" /\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n\n\u003ch2\u003eDescription\u003c/h2\u003e\n\n- A minimal upload component built for ReactJS\n- Play/Pause feature\n- Built with [Typescript](https://www.typescriptlang.org/)\n- Styled with [Styled Components](https://www.styled-components.com/)\n\n\u003ch2\u003eTable of Contents\u003c/h2\u003e\n\n- [Installation](#-installation)\n- [Getting Started](#getting-started)\n- [Props](#props)\n  - [Default Theme Types](#default-theme-types)\n- [Meta](#meta)\n\n## Installation\n\n```sh\n  yarn add react-upload-box\n```\n\n## Getting Started\n\n\u003e The box covers 100% of the parent `div`. Make sure to wrap it in a component with a flexible width. Otherwise, it \"wobbles\" as percentage changes.\n\n```javascript\n\n  import React, { useState } from 'react'\n  import { ReactUpload } from 'react-upload-box'\n  function App() {\n    const [percentage, setPercentage] = useState(0)\n    const [pause, setPause] = useState(false)\n    const uploadFile = async () =\u003e {\n      ...\n      setPercentage(newPercentage)\n    }\n    const handlePause = async () =\u003e {\n      ...\n      setPause(true)\n    }\n    const handleStart = async () =\u003e {\n        ...\n        setPause(false)\n    }\n    return (\n      \u003cdiv className=\"App\"\u003e\n        \u003cReactUpload\n          mode=\"light\"\n          theme={customTheme} //overrides mode\n          fileName={meta.fileName}\n          percentage={percentage}\n          paused={pause}\n          disabled={percentage === 100}\n          completed={percentage === 100}\n          onPause={handlePause}\n          onStart={handleStart}\n        /\u003e\n      \u003c/div\u003e\n    )\n  }\n  export default App\n\n```\n\n## Props\n\n| name         | type                                   | description                                                           | required | default                                           |\n| ------------ | -------------------------------------- | --------------------------------------------------------------------- | -------- | ------------------------------------------------- |\n| fileName     | `string`                               | file name of the uploading file                                       | true     | `undefined`                                       |\n| paused       | `boolean`                              | current pause state of the uploading file                             | true     | `undefined` (falsy)                               |\n| percentage   | `number`                               | percentage of file uploaded                                           | true     | `undefined`                                       |\n| completed    | `boolean`                              | prop to signal if upload completed (used to apply themes on complete) | false    | false                                             |\n| disabled     | `boolean`                              | prop to disable play/pause button (usually after upload finishes)     | false    | false                                             |\n| mode         | `light` or `dark`                      | light or dark theme mode (is overriden if `theme` is also supplied)   | false    | 'light' (allowed values: 'light' or 'dark')       |\n| onPause      | `() =\u003e void`                           | callback fired `onClick` of Pause Button press                        | false    | false                                             |\n| onStart      | `() =\u003e void`                           | callback fired `onClick` of Play Button press                         | false    | false                                             |\n| strokeHeight | `number` or `string`                   | height of the line from base line                                     | false    | `25%`                                             |\n| strokeWidth  | `number`                               | width of the line                                                     | false    | 2                                                 |\n| theme        | [`DefaultTheme`](#default-theme-types) | custom theme for the component                                        | false    | check [Default Theme Types](#default-theme-types) |\n\n### Default Theme Types\n\n**_box_**, **_overlayColor_**, **_line_**, **_icons_** share the same keys to control colors during different stages:\n\n```javascript\nrunning: 'color when upload is running',\npaused: 'color when upload is paused',\ncompleted: 'color when upload is completed',\ndisabled?: '(applicable to only icon) color when upload is disabled'\n```\n\n| key          | description                                       |\n| ------------ | ------------------------------------------------- |\n| box          | controls color of the container box's background  |\n| overlayColor | controls color of overlay's background            |\n| line         | controls color of curvy line's stroke             |\n| text         | controls color of `percentage` \u0026 `fileName` texts |\n| icons        | controls color of icons                           |\n\n#### Refer this configuration for more details:\n\n```javascript\nlightTheme: DefaultTheme = {\n  box: {\n    completed: '#b7dabe',\n    paused: '#f5f5f5',\n    running: '#f1f8f2',\n  },\n  overlayColor: {\n    completed: '#d5f5da'\n    paused: '#e6e6e6',\n    running: '#d5f5da',\n  },\n  line: {\n    completed: '#b5e2bc'\n    paused: '#00171F',\n    running: '#b5e2bc',\n  },\n  text: {\n    fileName: '#00171F',\n    percentage: '#00171F'\n  },\n  icons: {\n    completed: 'gray',\n    disabled: 'gray',\n    paused: '#00171f',\n    running: '#00171f'\n  }\n};\n```\n\n\u003e To create one's own `theme` copy paste these values and change them accordingly. All keys must be present otherwise the `properties` are set to `none`;\n\n## Mentions and References\n\nIcons\n\n- [Play](https://www.flaticon.com/authors/pixel-perfect)\n- [Pause](https://icon54.com)\n\nCode and configuration mentions\n\n- [Codepen - Aaron Iker](https://codepen.io/aaroniker/pen/QXxexJ?editors=1010)\n\n- [Dribbble - Jakub Antalik](https://dribbble.com/shots/6052541-Upload-window-interactions)\n\n- [React Chrono](https://github.com/prabhuignoto/react-chrono)\n\n## Meta\n\nDistributed under the MIT license. See `LICENSE` for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheersmas%2Freact-upload-box","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheersmas%2Freact-upload-box","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheersmas%2Freact-upload-box/lists"}