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

brgndyy-react-modal

v0.0.12

Published

공용 모달 라이브러리

Downloads

25

Readme

brgndyy-react-modal

Common React Modal Library Component

- Running Video

- install

npm install brgndyy-react-modal
yarn add brgndyy-react-modal

- How to use

import { useState } from "react";
import { Modal } from "brgndyy-react-modal";

export const CloseContent = () => {
  return <div>Close Modal Button Content</div>;
};

export const Content = () => {
  return <div>Modal Content</div>;
};

function App() {
  const [modalOpen, setModalOpen] = useState(false);

  const handleModalClose = () => {
    setModalOpen(false);
  };

  const handleModalOpen = () => {
    setModalOpen(true);
  };

  return (
    <>
      <Modal
        isOpen={modalOpen}
        onClose={handleModalClose}
        position="center"
        mountAnimation="modal_enter"
        unMountAnimation="modal_exit"
        animationTime={300}
      >
        <Modal.Portal id="modal">
          <Modal.Backdrop>
            <Modal.Container className="container">
              <Content />
              <Modal.CloseButton>
                <CloseContent />
              </Modal.CloseButton>
            </Modal.Container>
          </Modal.Backdrop>
        </Modal.Portal>
      </Modal>

      <button onClick={handleModalOpen}>Modal Open</button>
    </>
  );
}

export default App;

Modal Component Props

| Name | Datatype | Default | Description | | ---------------- | ----------------- | -------- | ------------------------------------ | | isOpen | boolean | false | state of Modal Open | | onClose | ()=> void | none | event of Modal Close | | position | 'center' 'bottom' | 'center' | Position of Modal Container | | mountAnimation | string | "" | Name of Animation When Modal mount | | unMountAnimation | string | "" | Name of Animation When Modal unmount | | animationTime | number | 300 | time of animation duration |

Pitfalls

❗️ Before using a modal, first create a root div for the modal in index.js ❗️

<body>
  <div id="modal"></div>
</body>

Modal Option Contents

There is built-in modal content that you can use right away.

- Title

A simple Modal Title

<Modal>
  <Modal.Portal id="modal">
    <Modal.Backdrop>
      <Modal.Container className="container">
        <Modal.Title className="title">Alert Title</Modal.Title>
      </Modal.Container>
    </Modal.Backdrop>
  </Modal.Portal>
</Modal>

- Description

A simple Modal Description

<Modal>
  <Modal.Portal id="modal">
    <Modal.Backdrop>
      <Modal.Container>
        <Modal.Confirm.Description>Modal Description</Modal.Confirm.Description>
      </Modal.Container>
    </Modal.Backdrop>
  </Modal.Portal>
</Modal>

- Prompt

Prompt required when receiving user input

const [value, setValue] = useState("");

const handleValue = (e: React.ChangeEvent<HTMLInputElement>) => {
  setValue(e.target.value);
};

<Modal>
  <Modal.Portal id="modal">
    <Modal.Backdrop>
      <Modal.Container>
        <Modal.Title>Coupon Numbers</Modal.Title>
        <Modal.Prompt
          value={value}
          onChange={handleValue}
          placeholder={"placeholder"}
        />
      </Modal.Container>
    </Modal.Backdrop>
  </Modal.Portal>
</Modal>;

- Confirm Button

const handleOnConfirm = () => {
  // event when confirm
  setModalOpen(false);
};

<Modal
  isOpen={modalOpen}
  onClose={handleModalClose}
  position="center"
  mountAnimation="modal_enter"
  unMountAnimation="modal_exit"
  animationTime={300}
  size="medium"
>
  <Modal.Portal id="modal">
    <Modal.Backdrop opacity="rgba(255, 255, 255, 0.3)">
      <Modal.Container className="container">
        <Modal.ConfirmButton onConfirm={handleOnConfirm}>
          Confirm
        </Modal.ConfirmButton>
      </Modal.Container>
    </Modal.Backdrop>
  </Modal.Portal>
</Modal>;

Author

License

MIT

function App() {
  return (
    <>
      <Modal
        isOpen={modalOpen}
        onClose={handleModalClose}
        position="center"
        mountAnimation="modal_enter"
        unMountAnimation="modal_exit"
        animationTime={300}
      >
        <Modal.Portal id="modal">
          <Modal.Backdrop>
            <Modal.Prompt
              titleClassName=""
              promptClassName=""
              title=""
              prompt=""
              value={value}
              onChange={onChange}
              onConfirm={onConfirm}
              placeholder={"placeholder"}
            />
          </Modal.Backdrop>
        </Modal.Portal>
      </Modal>

      <button onClick={handleModalOpen}>Modal Open</button>
    </>
  );
}

export default App;