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

devtreasure-react-modal-component

v1.3.8

Published

To begin using this package, follow these steps:

Downloads

12

Readme

react-modal-component

To begin using this package, follow these steps:

  • Step1: Go to the node_modules folder in your project and locate the folder named devtreasure-react-modal-component. Inside that folder, copy the modal.tsx file from the src folder. For the styles, copy the modal.module.css file from the styles folder.

  • Step2: Paste the modal.tsx file directly into your project's components folder.

  • Step3: Paste the modal.module.css file into the styles folder of your project.

image

  • Step4: Make sure you have the react-lazy-load-image-component package installed in your project.

  • Step5: In the package's src folder, locate the state.tsx file. Copy the state properties used and paste them into your own codebase.

Note: Only copy the state properties, not the entire function wrapper. The code should look something like this

const [modalState, setModalState] = useState({ isModal: false, message: "" });
  • Step6: Go to the function folder located at node_modules/devtreasure-react-modal-component. Copy the show and hide functions from that folder and paste them into your codebase where you imported the modal from.
  • Step 7: Importing the style

No need to worry about this step as it's already done for you. Just make sure you change the path to match your project's file structure. For example, your style import could look something like this: /styles/modal.module.css or /styles/animation/modal.module.css.

Your full code should look something like this:

import {
  LazyLoadImage,
  LazyLoadComponent,
} from "react-lazy-load-image-component";
import { useState, useEffect, MouseEventHandler, lazy } from "react";
const ReactModalComponent = lazy(
  () => import("../../components/function/modal/ReactModalComponent")
);

function App() {
  const [modalState, setModalState] = useState({ isModal: false, message: "" });

  const showModal = () => {
    setModalState((prevState) => {
      return {
        ...prevState,
        isModal: true,
      };
    });
  };
  const hideModal = () => {
    setModalState((prevState) => {
      return {
        ...prevState,
        isModal: false,
      };
    });
  };
  return (
    <>
      <LazyLoadComponent>
        <ReactModalComponent
          isModal={modalState.isModal}
          performTwoFunctions={performTwoFunctions}
          hideModal={hideModal}
        />
      </LazyLoadComponent>
    </>
  );
}
export default App;

How to show the modal

To display your modal, please copy the code snippet below. Note that it doesn't have to be a button; you can use any HTML tags in your codebase.

<button id={"hello-world"} onClick={showModal}>
  Show Modal
</button>

How to update Package

If you want to update the package simpley update using the following

| npm | yarn | pnpm | | -------------------------------- | ---------------------------------- | ----------------------------- | | $ npm update react-modal-component | $ yarn upgrade react-modal-component | $ pnpm up react-modal-component |

Note: In case there are significant changes to the code, please make sure to copy the updated code into your codebase again. . Note: You might see a function called performTwoFunctions. Please delete that. This was meant to pefrom two operations. When I was working on this.

.......................................................................................... . Note: Please note that your codebase may be different from the example provided. The key is to import the component, the style, and call the necessary functions accordingly.