🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

popup-react

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

popup-react

A collection of beautiful popup components for react.

1.1.0
latest
Source
npm
Version published
Weekly downloads
7
-41.67%
Maintainers
0
Weekly downloads
 
Created
Source

popup-react

popup-react is a lightweight collection of React components designed to enhance user experience. Currently, it features the ImageQuickView component, with more components planned for future releases.

Live Preview

https://popup-react.aburifat.com/

Installation

To install the package, run the following command:

npm install popup-react

or using yarn:

yarn add popup-react

Available Components

1. ImageQuickView

ImageQuickView allows users to quickly view a larger version of an image in a modal popup. It enhances the browsing experience for image-heavy applications such as e-commerce websites or galleries.

Usage

import { useState } from 'react'
import sea from './assets/sea.jpg'
import { ImageQuickView } from 'popup-react'

function App() {
  const [selectedImage, setSelectedImage] = useState<string | undefined>(undefined);

  const closeQuickView = () => {
    setSelectedImage(undefined);
  }

  return (
    <div>
      <img
        src={sea}
        onClick={() => setSelectedImage(sea)}
      />
      <ImageQuickView
        src={selectedImage}
        alt={"image alt"}
        bgWrapper={true}
        wrapperStyle={{
          color: '#fff',
          opacity: 0.7
        }}
        isVisible={!!selectedImage}
        onClose={closeQuickView}
      />
    </div>
  )
}

export default App

Props

  • src: (string) Required. The URL of the image to be displayed in the quick view.
  • alt: (string) Optional. The alt text for the image.
  • bgWrapper: (boolean) Optional. Show or hide background wrapper. (default: true)
  • wrapperStyle: (object) Optional. Contains the color and opacily property of the background Wrapper.
  • isVisible: (boolean) Optional. Show or hide the quick view. (default: false)
  • onClose: (function) Required. Callback function triggered when the modal is closed.

Example

const closeQuickView = () => {
    setSelectedImage(undefined);
}
<ImageQuickView
  src={selectedImage}
  alt={"image alt"}
  bgWrapper={true}
  wrapperStyle={{
    color: '#fff',
    opacity: 0.7
  }}
  isVisible={!!selectedImage}
  onClose={closeQuickView}
/>

Upcoming components

  • Toast
  • Action Dialog

Upcoming Improvements

  • Transition animations

License

This project is licensed under the MIT License.

Keywords

react

FAQs

Package last updated on 03 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts