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

hae-on-bottom-sheet

v0.1.3

Published

TypeScript와 React로 구현한 Bottom Sheet 라이브러리입니다.

Downloads

3

Readme

Bottom Sheet 라이브러리

TypeScript와 React로 구현한 Bottom Sheet 라이브러리입니다.

Bottom Sheet 컴포넌트를 사용할 수 있는 Bottom Sheet

Bottom Sheet를 여닫을 수 있는 custom hook useBottomSheet가 있습니다.

설치 방법

npm install 'hae-on-bottom-sheet'
yarn add 'hae-on-bottom-sheet'

사용 방법

😎 Bottom Sheet

Bottom Sheet 컴포넌트 불러오기

import { BottomSheet } from 'hae-on-bottom-sheet';

Bottom Sheet 컴포넌트 사용하기

해당 컴포넌트는 children(React Element)을 받아서 사용합니다.

따라서 Bottom Sheet가 필요한 컴포넌트의 외부에서 사용해주세요.

import { BottomSheet } from 'hae-on-bottom-sheet';

interface ExampleProps {
  onClose: () => void;
}

const Example = ({ onClose }: ExampleProps) => {
  return (
    //이곳에서 사용합니다.
    <BottomSheet onClose={onClose}>
      // Bottom Sheet 내부에 들어갑니다.
      <ExampleContainer>내용을 입력하세요</ExampleContainer>
    </BottomSheet>
  );
};

export default Example;

😎 useBottomSheet

useBottomSheet custom hook 불러오기

import { useBottomSheet } from 'hae-on-bottom-sheet';

useBottomSheet custom hook 사용하기

const { isBottomSheetOpen, handleBottomSheetOpen, handleBottomSheetClose } =
  useBottomSheet();

isBottomSheetOpen

해당 bottom sheet의 여닫는 상태입니다.

isBottomSheetOpen의 상태에 따라 뒤에 오는 컴포넌트의 렌더링 여부가 결정됩니다.

예시)

{
  isBottomSheetOpen && <BankList onClose={handleBottomSheetClose} />;
}

handleBottomSheetOpen

bottom sheet를 열 수 있습니다.

props로 전달하여 사용할 수 있습니다.

예시)

//CardList.tsx
// 사용하고자하는 컴포넌트에 props로 전달 후
<CardItem card={card} onOpen={handleBottomSheetOpen} />

//CardItem.tsx
// BankChangeBtn이 클릭되면 Bottom Sheet가 열립니다.
<BankChangeBtn onClick={onOpen}>{card.bankName}</BankChangeBtn>

handleBottomSheetClose

bottom sheet를 닫을 수 있습니다.

props로 전달하여 사용할 수 있습니다.

예시)

//CardList.tsx
// 사용하고자하는 컴포넌트에 props로 전달 후
<CardItem card={card} onClose={handleBottomSheetClose} />

//CardItem.tsx
// BankChangeBtn이 클릭되면 Bottom Sheet가 닫힙니다.
<BankChangeBtn onClick={onClose}>{card.bankName}</BankChangeBtn>

ESC & Back Drop

해당 Bottom Sheet는 ESC 키를 누르거나 Back Drop 클릭으로 닫을 수 있습니다.