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-common-modal-module

v0.1.1

Published

react common modal module

Downloads

1

Readme

Install

npm install react-common-modal-module
# or
yarn add react-common-modal-module

Usage

ContextProvider setting

// root index.jsx or App.jsx...
// ...
import { ModalContextProvider } from "react-common-modal-module";

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
    <ModalContextProvider>
        <App />
    </ModalContextProvider>
);

openModal

Modal Contents는 기본 스타일이 적용되어 있지 않으며 중앙정렬이 되어 있습니다.

각각 컴포넌트를 openModal(arg1 : React.ReactNode)을 사용하여 적용합니다.

import { useModal } from "react-common-modal-module";

function App() {
    const { openModal } = useModal();

    const handleOpenModal = () => {
        // modal component 커스텀
        // React.ReactNode arg
        openModal(<div>Modal Component</div>);
    };

    return (
        <div>
            <button onClick={handleOpenModal}>open modal</button>
        </div>
    );
}

closeModal

background 배경이 fixed로 적용되어 있으며 배경 클릭시 closeModal이 동작하도록 되어있습니다.

import { useModal } from "react-common-modal-module";

function App() {
    const { openModal, closeModal } = useModal();

    const handleOpenModal = () => {
        // modal component 커스텀
        openModal(
            <div>
                Modal Component
                <button onClick={closeModal}>close modal</button>
            </div>
        );
    };

    return (
        <div>
            <button onClick={handleOpenModal}>open modal</button>
        </div>
    );
}

Issue Reporting

버그를 발견했거나 기능 요청이 있는 경우 Issue 부탁드립니다.