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

v0.4.14

Published

A react component for modals and dialogs which allows you to have custom header and super easy overrides of default styles.

Downloads

7

Readme

react-header-modal

React Header-modal is a simple react component for modals and dialogs. Powerful, lightweight and customizable design. It is based on https://github.com/marcio/react-skylight but re-written to use header and body.

NPM

Travis CI Coverage Status Quality dependencies devdependencies

Installation

npm i --save react-header-modal

License

License is MIT

Features

  • Very simple modal/dialog
  • Callback before open
  • Callback after open
  • Callback before close
  • Callback after close
  • Callback on overlay click
  • All styles can be overridden or not used at all

Proptypes

ModalView.propTypes = {
    afterClose: PropTypes.func,
    afterOpen: PropTypes.func,
    beforeClose: PropTypes.func,
    beforeOpen: PropTypes.func,

    title: PropTypes.string,
    body: PropTypes.string,
    children: PropTypes.object,

    onOverlayClicked: PropTypes.func,
    hideOnOverlayClicked: PropTypes.bool,
    showOverlay: PropTypes.bool,
    isVisible: PropTypes.bool,

    styles: React.PropTypes.oneOfType([
        PropTypes.shape({
            closeButtonStyle: PropTypes.object,
            dialogStyles: PropTypes.object,
            overlayStyles: PropTypes.object,
            titleStyle: PropTypes.object
        }),
        PropTypes.bool,
    ]),

}

How to use

import ModalView from 'react-header-modal';

<ModalView />

Default view.

default

import ModalView from 'react-header-modal';

<ModalView 
  hideOnOverlayClicked
  title="Hi, xxx modal"
  body="Simple Text"
/>

Simplest use is to pass the title and the body as an attribute.

simplest

import ModalView, {Body, Header} from 'react-header-modal';

<ModalView hideOnOverlayClicked>
    <Header>
        <ul>
            <li>Lorem ipsum dolor sit amet, impetus dissentiunt vix ne. Vix accumsan adipisci no, ius no
                populo voluptaria, no eam viderer appareat persequeris. Ex harum tollit nullam mea. Mei
                sanctus placerat ut, ad mei recusabo instructior, quo eu nonumes deleniti principes. Ceteros
                oportere aliquando ei pro, et dolores forensibus quo, te zril adolescens vix. Pro at illum
                dicit referrentur, fabellas conclusionemque ne nam.
            </li>
            ...
            <li>Lorem ipsum dolor sit amet, impetus dissentiunt vix ne. Vix accumsan adipisci no, ius no
                populo voluptaria, no eam viderer appareat persequeris. Ex harum tollit nullam mea. Mei
                sanctus placerat ut, ad mei recusabo instructior, quo eu nonumes deleniti principes. Ceteros
                oportere aliquando ei pro, et dolores forensibus quo, te zril adolescens vix. Pro at illum
                dicit referrentur, fabellas conclusionemque ne nam.
            </li>
    
        </ul>
    </Header>
    <Body>
        <ul>
            <li>Lorem ipsum dolor sit amet, impetus dissentiunt vix ne. Vix accumsan adipisci no, ius no
                populo voluptaria, no eam viderer appareat persequeris. Ex harum tollit nullam mea. Mei
                sanctus placerat ut, ad mei recusabo instructior, quo eu nonumes deleniti principes. Ceteros
                oportere aliquando ei pro, et dolores forensibus quo, te zril adolescens vix. Pro at illum
                dicit referrentur, fabellas conclusionemque ne nam.
            </li>
            ...
            <li>Lorem ipsum dolor sit amet, impetus dissentiunt vix ne. Vix accumsan adipisci no, ius no
                populo voluptaria, no eam viderer appareat persequeris. Ex harum tollit nullam mea. Mei
                sanctus placerat ut, ad mei recusabo instructior, quo eu nonumes deleniti principes. Ceteros
                oportere aliquando ei pro, et dolores forensibus quo, te zril adolescens vix. Pro at illum
                dicit referrentur, fabellas conclusionemque ne nam.
            </li>
    
        </ul>
    </Body>
</ModalView>

You can pass anything to header and body.

head_body_lot

import ModalView from 'react-header-modal';

<ModalView 
  hideOnOverlayClicked
  title="Hi, xxx modal"
  body="Simple Text"
  styles={{
    contentStyle: {
      backgroundColor: '#767535'
    }
  }}
/>

Simply override the default styles or turn them off (styles={false}) and use the class name hooks for add the styling.

style

import ModalView from 'react-header-modal';

<ModalView 
  hideOnOverlayClicked
  title="Hi, xxx modal"
  body="Simple Text"
  isVisible={true}
/>

You can show the modal visible when page has loaded, e.g. to show a notice or whatever.

You can use the "ESC" key to close the modal view.