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

v1.0.0

Published

simple fucking react modal

Downloads

3

Readme

react-router-modal

A simple way to handle showing modals with react-router version 4.

Installation

Install using yarn or npm.

npm install react-router-modal --save yarn add react-router-modal

peerDependencies

react-router-modal requires:

react-router-dom version 4 react & react-dom, version 15

Components

ModalContainer

ModalContainer contains all modals that are shown. Typically you will want to mount this just before your closing </body> tag. Nothing will be rendered into the dom if no modals are current shown.

props
  • bodyModalOpenClassName

Class name to set on the <body> when a modal is mounted. Typically used to prevent default scroll behavior, etc. Defaults to react-router-modal__modal-open

  • containerClassName Class name for the modal container element. Note that this element is only rendered when at least one modal is shown.

Defaults to react-router-modal__modal-container

  • backdropClassName Class name for the modal backdrop element(s) that are show behind each modal. Defaults to react-router-modal__modal-backdrop

  • modalClassName Class name for the modal element(s) that wrap the modal content. Can be overridden by the className property on <ModalRoute /> or <Modal />

Defaults to react-router-modal__modal

ModalRoute

ModalRoute attaches a component to a route.

props
  • path

The path to match. See react-router docs.

  • component

The component to render inside the modal when the path is matched.

  • exact

Only match on exact route match. See react-router docs.

  • props

Properties to be passed to the component when the route is matched. The react-router props location', 'history', and 'match will also be included.

  • className

If set, overrides the modalClassName property on the ModalContainer

When the route matches, the component will be shown inside a modal. If multiple routes match, the modals will be stacked based on the length of the path that is matched.

Modal

If you want to show a modal without a route, you can use this. Modals shown this way default to stacking on top of modals shown with ModalRoute.

props
  • component

The component to render inside the modal when the path is matched.

  • props

Properties to be passed to the component rendered inside the modal.

  • stackOrder

Controls the order the modals are stacked. Higher number means "on top".

  • className

If set, overrides the modalClassName property on the ModalContainer

CSS

Default css is included in css/react-router-modal.css. You can use this as a basis for your own modal styles.