1.1.4 • Published 2 years ago

react-augusta-events v1.1.4

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

React Augusta Events

One of the simplest forms of encryption

Install

$ npm install --save react-augusta-events

or

$ npm i -S react-augusta-events

Hooks

1. useDragDrop

2. useClipboard

Usage

1. useDragDrop

import { useDragDrop } from 'react-augusta-events/lib';


...
function App() {
  const { elRef, listening, isDropZone, isUpload } = useDragDrop({
    onUploadFile: (data) => {
      console.log(data);
    },
  });

  return (
    <div className="App">
      <header className="App-header">
        <div
          ref={elRef}
          className={isDropZone ? "in-drop" : "drop-zone"}
          {...listening}
        >
          {isUpload ? "Successufly upload!" : ( isDropZone ? "Now Drop you File" : "Upload you file" )}
        </div>
      </header>
    </div>
  );
}

API ( useDragDrop )

Field: isDropZone : boolean - for item behaviour, Field: isUpload : boolean - for upload behaviour,

2. useClipboard

import { useClipboard } from "react-augusta-events/lib";
import { useState } from "react";

export default function App() {
  let [value, setValue] = useState("");
  let { elRef, boards, isCopy, isPaste, isCut } = useClipboard({
    copyValue: (data) => {
      console.log("copy", data);
    },
    cutValue: (data) => {
      console.log("cut", data);
    },
    pasteValue: (data) => {
      console.log("paste", data);
      setValue(data.pasteText);
    }
  });

  return (
    <div className="App">
      <header className="App-header">
        <h1>{value}</h1>
        {isCopy && <p>"Copy code!"</p>}
        {isCut && <p>"Cut code!"</p>}
        {isPaste && <p>"Paste code!"</p>}
        <input
          ref={elRef}
          value={value}
          onChange={({ target }) => setValue(target.value)}
          className="copyCard"
          {...boards}
        />
      </header>
    </div>
  );
}
import { useClipboard } from 'react-augusta-events/lib';


...
  let { elRef, boards, isCopy } = useClipboard({
    copyValue: (data) => {
      console.log("copy",data);
    },
  })

  return (
    <div className="App">
    <header className="App-header">
      {isCopy && <h2>"Copy code!"</h2>}
      <div ref={elRef} className="copyCard" {...boards}>
        #f4bf4a 
      </div>
    
    </header>
  </div>
  );

API ( useClipboard )

Field: isCopy : boolean - for copy text, Field: isPaste : boolean - for paste text, Field: isCut : boolean - for cut text,

"Your Developing Software Engineer"

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago