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

v1.0.0

Published

Flexible and easy-to-use modal library for React, supporting customizable dialogs with promise-based interactions.

Downloads

87

Readme

React Snappy Modal

React Snappy Modal은 React 애플리케이션을 위한 커스터마이징이 가능한 모달/다이얼로그 라이브러리

React 컴포넌트를 모달 내부에 쉽게 렌더링하고 Promise 기반 상호작용을 제공합니다.

Features

  • 모달 내부에 어떤 React 컴포넌트도 렌더링 가능.
  • 모달 밖 클릭 시 모달을 닫는 등의 동작을 allowOutsideClick 같은 옵션으로 제어 가능.
  • 모달이 닫힌 후 스크롤 위치 복원.
  • 모달의 열림/닫힘 상태를 state로 관리하지 않아도 됨..

Installation

npm install react-snappy-modal
yarn add react-snappy-modal
pnpm add react-snappy-modal

Usage

// main
import { SnappyModalProvider } from "react-snappy-modal";

ReactDOM.createRoot(document.getElementById("root")).render(
  <React.StrictMode>
    <SnappyModalProvider>
      <App />
    </SnappyModalProvider>
  </React.StrictMode>,
);

// app
import React from 'react';
import { SnappyModal } from 'react-snappy-modal';

function App() {
  const showModal = () => {
    SnappyModal.show(<YourModalComponent />, {
      allowOutsideClick: true
    }).then((result) => {
      console.log('모달 닫힘', result);
    });
  };

  return (
    <div>
      <button onClick={showModal}>모달 열기</button>
    </div>
  );
}

export default App;
// YourModalComponent
import React from 'react';
import SnappyModal from 'react-snappy-modal';

function YourModalComponent() {
  return (
    <div>
      <h1>모달 내용</h1>
      <button onClick={SnappyModal.close("some result")}>닫기</button>
    </div>
  );
}

export default YourModalComponent;

자세한 내용은 sample 프로젝트를 참고하세요.