npm.io
1.2.3 • Published 6 years ago

@mik-a/tiny-uploader

Licence
ISC
Version
1.2.3
Deps
3
Size
10 kB
Vulns
0
Weekly
0

tiny-uploader

Customizable React component/button for uploading text files.

Works with most common text documents such as .txt and .md

Installation

npm i @mik-a/tiny-uploader --save

Usage

import UploadeTextFile from '@mik-a/tiny-uploader'

<UploadTextFile fileContentHandler={fileContentHandler} fileInfo={fileInfoHandler} label='Upload' className='my-custom-class' />

// Example of functions

  const fileContentHandler = e => {
    console.log('text content: ', e)
  }

  const fileInfoHandler = e => {
    console.log('file info', e)
    // name, lastModified, webkitRelativePath , size , type 
  }

Props

fileContentHandler // function()

FileInfo // function()

Optional props

label // 'string' - default 'Upload text'

className // 'string' - your custom CSS class

Default CSS

.tiny-uploader {
	border: 1px solid;
	padding: 0.8rem 1.8rem;
	border-radius: 1.8rem;
}

Author