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-price-animation

v1.0.5

Published

A component for animating numbers and prices in React.

Downloads

992

Readme

React-price-animation

은행, 이커머스 사이트 등에서 거래가 이루어질 때, 가격이나 숫자의 변동을 사용자에게 더욱 생생하게 전달하기 위해 애니메이션 효과를 적용할 수 있습니다.

Install

npm

npm install react-price-animation

yarn

yarn add react-price-animation

pnpm

pnpm install react-price-animation

Site

https://react-price-animation.vercel.app/?path=/docs/count--docs

Usage

React 컴포넌트에 react-price-animation를 import하여 사용합니다.

import { Count } from 'react-price-animation';

function App() {
  return (
    <div className='App'>
      <Count number={12345} />
    </div>
  );
}

export default App;

Props

  • number : 숫자나 "123,000"과 같이 쉼표로 구분된 형식의 문자열을 입력받습니다.
  • delay : 각 자릿수의 애니메이션 시작 시간을 나타냅니다. 기본값은 0.15입니다.
  • height : 숫자의 높이를 지정합니다. 높이는 최소한 글자 크기만큼이어야 합니다. 기본값은 20px입니다.
  • startDirection : 애니메이션의 시작 방향을 지정합니다. 'left'는 왼쪽에서 시작하는 것을 의미하며, 'right'는 오른쪽에서 시작하는 것을 나타냅니다. 기본값은 'right'입니다.
  • comma : 쉼표 표시 여부를 결정합니다. 기본값은 true입니다.
  • initialAnimation : 첫 렌더링 시 애니메이션을 보여줄지 여부를 나타냅니다. 기본값은 true입니다.
  • other : HTMLAttributes 속성을 사용할 수 있습니다.

| 속성명 | 필수 여부 | 기본값 | 가능한 타입 | | :--------------: | :------------: | :----: | :------------------------------: | | number | required(필수) | - | number,string | | delay | option(선택) | 0.15 | number | | height | option(선택) | 20px | string | | startDirection | option(선택) | right | left,right | | comma | option(선택) | true | boolean | | initialAnimation | option(선택) | true | boolean | | other | option(선택) | - | HTMLAttributes<HTMLDivElement> |

Example

  • number 값이 문자열일 때
import { Count } from 'react-price-animation';

function App() {
  return (
    <div className='App'>
      <Count number={'12,345'} />
    </div>
  );
}

export default App;
  • 모든 props를 적용했을 때
import { Count } from 'react-price-animation';

function App() {
  return (
    <div className='App'>
      <Count number={12345} delay={0.1} height={'15px'} startDirection={'left'} />
    </div>
  );
}

export default App;
  • css 적용
import { Count } from 'react-price-animation';

function App() {
  return (
    <div className='App'>
      <Count className={price} number={price?.toLocaleString('ko-KR')} delay={0.1} />
    </div>
  );
}

export default App;
  • 이벤트 적용
import { Count } from 'react-price-animation';

function App() {
  return (
    <div className='App'>
      <Count
        className={styles.price}
        number={price?.toLocaleString('ko-KR')}
        delay={0.1}
        onClick={() => console.log(123)}
      />
    </div>
  );
}

export default App;

License

This project is licensed under the MIT License - see the LICENSE.md file for details.