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-elastic-modal

v0.2.0

Published

React elastic modal component

Downloads

9

Readme

react-elastic-modal

React elastic modal component

Build Status Code Climate MIT License

Screenshot

screenshot

DEMO

http://bokuweb.github.io/react-elastic-modal/

Example

<Modal
  isOpen={ this.state.isOpen }
  onRequestClose={ () => this.setState({ isOpen: false }) }
  modal={{
    width: '50%',
    height: '360px',
    backgroundColor: '#fff',
    opacity: 0.5,
  }}
  overlay={{
    background: 'rgba(0, 0, 0, 0.4)',
  }}
>
  <div style={{ padding: '50px', overflowY: 'scroll', position: 'relative' }}>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <div className="button--close" onClick={ () => this.setState({ isOpen: false }) }>close modal</div>
    <i
      className="fa fa-close"
      onClick={ () => this.setState({ isOpen: false }) }
      style={{ color: '#fff', position: 'absolute', top: '20px', right: '20px', cursor: 'pointer', fontSize: '20px' }}
    />
  </div>
</Modal>

Props

isOpen: PropTypes.bool.isRequired

If true, the modal is open. If false, the modal is closed.

onRequestClose: PropTypes.func

This callback is called when overlay element clicked. If you want to close modal when overlay clicked, please set isOpen state false in this callback.

modal: PropTypes.shape

This props specify modal styles.

modal: PropTypes.shape({
  backgroundColor: React.PropTypes.string.isRequired,
  width: React.PropTypes.string.isRequired,
  height: React.PropTypes.string.isRequired,
  opacity: React.PropTypes.number,
  zIndex: React.PropTypes.number,
})
  • backgroundColor: Specify modal background color.
  • width: Specify modal width. i.e. width: '100px' or width: '50%'.
  • height: Specify modal width. i.e. height: '100px' or height: '50%'.
  • opacity: Specify modal opacity. Default value is 1.
  • zIndex: Specify modal zIndex. Default value is 101.

Attention

react-elastic-modal rendered by svg. if you set modal size {width: 100px, height: 200px}, svg width and height is set {width: 110px, height: 220px}.

overlay: PropTypes.shape

This props specify overlay styles.

overlay: PropTypes.shape({
  background: React.PropTypes.string,
  zIndex: React.PropTypes.number,
})
  • background: Specify overlay background. Default value is rgba(0, 0, 0, 0.8).
  • zIndex: Specify overlay zIndex. Default value is 100.

ChangeLog

v0.1.3

  • Fix test

v0.1.2

  • Bug Fix (thanks @59naga)

v0.1.1

  • Add Unit Test

v0.1.0

  • Published

License

The MIT License (MIT)

Copyright (c) 2016 Bokuweb

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.