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-bootstrap-dynamic-modal

v0.0.14

Published

Add dialogs to your site for light boxes, user notifications, or completely custom content.

Downloads

10

Readme

React Bootstrap Dynamic Modal

Add dialogs to your site for lightboxes, user notifications, or completely custom content.

import { BasicModal, ConfirmationModal } from "react-bootstrap-dynamic-modal"; 

Basic Modal

Basic modal behaves similar to bootstrap modal

  • Default it has the close button and modal body is scrollable.

Confirmation Modal

Modal would not hide until unless user take an action by clicking buttons. It would not hide by pressing ESC button and clicking outside of the modal.

  • Does not have the close button and modal body is scrollable.

Example

function App() {
  const [modalFlag, setModalFlag] = useState(false);
  const [confirmationModalFlag, setConfirmationModalFlag] = useState(false);
  const [errorModalFlag, setErrorModalFlag] = useState(false);
  let basicModalProps = {
    title: "Basic Modal",
    size: 'lg',
    modalClass: 'modal-width',
    bodyClass:'modal-body-bg',
    headerClass:'modal-header-bg',
    isAnimate: false,
    buttons: [
      {
        variant: "secondary",
        handler: () => setModalFlag(false),
        label: "Cancel"
      },
      {
        variant: "primary",
        handler: () => setModalFlag(false),
        label: "Save"
      }
    ],
    onHide: () => setModalFlag(false)
  }

  let confirmationModalProps = {
    title: "Confirmation Modal",
    body: "Are you sure?",
    size: 'xs',
    isAnimate: false,
    isCenter: true,
    buttons: [
      {
        variant: "secondary",
        handler: () => setConfirmationModalFlag(false),
        label: "Cancel"
      },
      {
        variant: "primary",
        handler: () => setConfirmationModalFlag(false),
        label: "Yes"
      }
    ]
  }

  let errorModal = {
    title: "Session Time",
    body: "Your session timeout due to security",
    size: 'xs',
    isAnimate: false,
    isCenter: true,
    buttons: [
      {
        variant: "primary",
        handler: () => setErrorModalFlag(false),
        label: "Logout"
      }
    ],
  }

  return (
    <div className="App">
      <ButtonToolbar>
        <Button variant="primary" onClick={() => setModalFlag(true)}>Modal</Button>
        <Button variant="secondary" onClick={() => setConfirmationModalFlag(true)}>Confirmation Modal</Button>
        <Button variant="success" onClick={() => setErrorModalFlag(true)}>System Error</Button>
      </ButtonToolbar>
      {/* pass visibility flag to show/hide modal */}
      <BasicModal {...{ ...basicModalProps, "visibility": modalFlag }} />
      <ConfirmationModal {...{ ...confirmationModalProps, "visibility": confirmationModalFlag }} />
      <ConfirmationModal {...{ ...errorModal, "visibility": errorModalFlag }} />
    </div>
  );
}
export default App;

Output

Basic Modal Basic Modal

Confirmation Modal Confirmation Modal

Alert Modal Alert Modal

Modal Properties

| Name |Type |Default | Description | | ------------ | ------------ | ------------ | ------------ | | title | String, Number and HTML(DOM) String | | Displays title in the modal header | | body | String, Number and HTML(DOM) String | | Displays content in the modal body | |size | xl/lg/xs/sm/ | lg | Renders the size of the modal as xl/lg/xs/sm | | headerClass | String | | Customizable class to be applied on modal header | | bodyClass | String | | Customizable class to be applied on modal body | | modalClass | String | | Customizable class to be applied on modal | | isAnimate | Boolean | true | A Modal can also be animated. For that set the "animation" prop to false/true. | | isCenter | Boolean | false | A Modal can also be position Centered. For that set the "isCenter" prop to false/true. | | buttons | Array of objects | | Represents button in modal footer | | onHide | Function | | Fired(Triggered) when modal hides |