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

image-verification-rotation

v1.5.1

Published

This is a react component that implements the function of rotating images for verification and used typescript

Downloads

13

Readme

Welcome to use the rotating image verification code component. This component is written for React

Warehouse address: https://github.com/wangchuaichuai/react-image-verification-rotation

This component uses "clip-path" CSS properties, which may result in incompatibility with lower versions of IE browsers

If the overlay setting for compatible IE browsers is false, do not use this property

Develop the canvas version later on

At the same time, all relevant attributes of div can also be used

Welcome to raise questions for improvement

Parameter Introduction

interface ImageVerificationProps extends HTMLAttributes<HTMLDivElement> {
  src?: string
  offsetAngleTemp?: number
  onSuccess?: Function
  onFailer?: Function
  overlay?: boolean
  imgShow?: boolean
  width?: number
  height?: number
  imgWidth?: number
  deviationAngle?: number
  successText?: string
  failText?: string
  initText?: string
  CustomButton?: React.ReactNode
}
  • The above are optional parameters

  1. src is the address of the rotated image. If it is not passed in, use the image link I provided
  2. offsetAngleTemp is the initial angle. You can provide the initial angle yourself or use the built-in random angle without passing in this parameter
  3. onSuccess is a method that triggers when validation passes
  4. onFailer is a method that triggers when validation fails
  5. overlay overlay images to create small traps and large circles
  6. imgShow is a boolean value that displays the original image when it is true, and not when it is false
  7. width is the width of the component
  8. height is the height of the component
  9. imgWidth is the width and height of the image
  10. deviationAngle is the deviation value of the verification angle, with a default deviation of 5 degrees
  11. successText is the copy that has been successfully verified
  12. failText is the copy that failed validation
  13. initText is the prompt text
  14. CustomButton allows you to customize the style of the reset button by defining an element and passing it in

Use

  1. you can use
npm install image-verification-rotation

or

yarn add image-verification-rotation
  1. This library uses the ES6 module export, so when used
import Verification from 'image-verification-rotation'
  1. There is already a. dts declaration file in the file, so there is no need to import @ types/image verification annotation
  2. use
<Verification  />
// or
  <App
    style={{ margin: '200px auto' }}
    imgWidth={400}
    height={400}
    width={400}
    overlay={true}
    imgShow={true}
  />

Example

  1. imgShow = true imgShow = true
export default function Example() {
  const Btn: React.FC = () => {
    return <button>sadas</button>
  }
  return (
    <Verification
      style={{ margin: '200px auto' }}
      onSuccess={() => console.log('success')}
      onFailer={() => console.log('failer')}
      offsetAngleTemp={54}
      deviationAngle={10}
      CustomButton={<Btn />}
    />
  )
}
  1. imgShow = false && overlay = true

imgShow = false && overlay = true

export default function Example() {
  const Btn: React.FC = () => {
    return <button>sadas</button>
  }
  return (
    <Verification
      style={{ margin: '200px auto' }}
      onSuccess={() => console.log('success')}
      onFailer={() => console.log('failer')}
      offsetAngleTemp={54}
      imgShow={false}
      overlay={true}
      deviationAngle={10}
      CustomButton={<Btn />}
    />
  )
}
  1. imgShow = true && overlay = true

imgShow = true && overlay = true

export default function Example() {
  const Btn: React.FC = () => {
    return <button>sadas</button>
  }
  return (
    <Verification
      style={{ margin: '200px auto' }}
      onSuccess={() => console.log('success')}
      onFailer={() => console.log('failer')}
      offsetAngleTemp={54}
      imgShow={true}
      overlay={true}
      deviationAngle={10}
      CustomButton={<Btn />}
    />
  )
}