You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

lightbox-appco

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lightbox-appco

A full featured lightbox component for react

1.0.4
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

#LightBox-AppCo is a simple styled React component that you can use to add a "popup" menu to your React application.

######Installation

npm install lightbox-appco

######Usage

import LightBox from 'lightbox-appco'
import SomeComponentOrElement from './SomeComponentOrElement'

class MyApp extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            showLightBox: false //set the lightbox to not mount initially
        }
        this.closeLightBox = this.closeLightBox.bind(this)
        this.showLightBox = this.showLightBox.bind(this)
    }

    //function for closing the lightbox
    //this will be passed into the LightBox compoent as the closing funtion
    closeLightBox = () => {
        this.setState({ showLightBox: false })
    }

    //function for opening the lightbox
    showLightBox = () => {
        this.setState({ showLightBox: true })
    }

    render() {

        return (

            <SomeComponentOrElement onClick={this.showLightBox}>

            {this.state.showLightBox ? (
                <LightBox
                    backgroundDimmer="2"
                            //The backgroundDimmer prop sets the degree of dimming behind the light box.
                            //The lowest (lighting dimming) is 1. The highest (darkest dimming) is 99.
                            //If this property is not specified it defaults to 2.
                    style={//The style prop takes an object of stype properties. You can
                            //provide any combination of these or none at all.
                            //Whatever you do not specify will default to a general
                            //styke that should work well for most purposes.
                            //The default values are shown below.
                        {
                            zIndex: "10",
                            margin: "25px auto auto auto",
                            padding: "25px",
                            width: "600px",
                            height: "80%",
                            backgroundColor: "white",
                            borderRadius: "5px",
                            borderColor: "white",
                            borderStyle: "solid",
                            borderWidth: "3px",
                            top: "20",
                            left: "20"
                        }
                    }
                    close={this.closeLightBox}
                    //The close property must be specified or you
                    //will have no way to close the lightbox once it is opened.
                >
                    //must pass in child components or other data. Whatever you put here will be
                    //in the body of the light box
                </LightBox>
            ) : null }
    )
 }
}

Keywords

popup

FAQs

Package last updated on 29 Apr 2019

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.