npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2024 – Pkg Stats / Ryan Hefner

react-uploader-master

v1.0.5

Published

A simple prototype for uploading a photo by the user and previewing that photo to the user πŸ‘¨β€πŸ’»

Downloads

377

Readme

A quick look

  • Help your website's UX with this package

  • A package for previewing the photo selected by the user with the possibility of deleting the previous image and uploading a new one

  • After selecting the image desired by the user, the complete information of this image will be sent to you through the onDataSend property

  • Ability to change text, color, shadow, etc. in Uploader

  • The user can only upload a valid image with the format (of your choice).

  • Ability to receive GIF from the user and preview it

  • Ability to set the desired width and height to Uploader

Upload Image In Package

Error Handling In Package

Next Release * Adding the ability to drag and drop the image in the Uploader box πŸ‘¨β€πŸ’»

Usage ✍

  • Install Package
npm i react-uploader-master
  • Import the Uploader component first.
import Uploader from 'react-uploader-master'
  • Then enter these essential items to launch Uploader
<Uploader
  onDataSend={file => {
    setFile(file) // Necessary
  }}
/>

Ready Example

import { useState, useEffect } from 'react';
import Uploader from 'react-uploader-master'

export default function App() {
  const [file, setFile] = useState(null)

  useEffect(() => {
    if (file) {
      console.log(file);
    }
  }, [file])

  return (
    <div>

      <Uploader
        onDataSend={file => {
          setFile(file) // Necessary
        }}
        // ↓ by default set
        //imgFormatsAllow={['jpg', 'jpeg', 'png', 'webp', 'jfif']}
        //imgFormatsNotAllowed={['tiff', 'bmp', 'svg', 'gif']}
      />

    </div>
  );
}

Package Props πŸ‘¨β€πŸ’»

| Parameter | Type | Field Status | Description | | :-------- | :------- | :------ | :-------------------------------- | | boxWidth | Number | Optional | Setting the width for the uploader box | | boxHeight | Number | Optional | Setting the height for the uploader box | | bgColor | String | Optional | Setting the background color for the Uploader box | | boxShadow | Boolean | Optional | Enable or disable shadow behind Uploader | | minSizeImg | Number | Optional | Specifies the minimum size of a photo (the number you enter is in kilobytes) | | maxSizeImg | Number | Optional | Specifies the maximum size of a photo (the number you enter is in kilobytes) | | activeRemoveBtn | Boolean | Optional | The delete button enables or disables the photo selected by the user | | displayModeRemoveBtn | String | Optional | you can change the delete button to 'icon' or 'btn'. | | imgFormatsAllow | Array | Optional | Valid formats for the photos you accept | | imgFormatsNotAllowed | Array | Optional | Invalid formats for photos you don't accept | | title | String | Optional | You can replace the text in the Uploader box with your desired text | | onDataSend | Function | Required | To access the information of the user's selected photo, it returns a function containing an argument named file |

β•”β•š onDataSend ╝╗

onDataSend To access the information of the user's selected photo, it returns a function containing an argument named file

| Parameter | Type | Field Status | Description | | :-------- | :------- | :------ | :-------------------------------- | | file | Array | Required | It contains complete information about the image selected by the user |

How to use and get the file argument from the function input:

onDataSend={file => {
    setFile(file)  // Necessary
}}

Social Network