Skip to content

tony-tsx/ink-progress-bar-pacman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ink-progress-bar-pacman

Progress bar pacman style

Install

yarn add ink-progress-bar-pacman

Usage

import React from 'react'
import { render } from 'ink'
import ProgressBarPacman from 'ink-progress-bar-pacman'

const App = () => {
  const [current, setCurrent] = useState(0)

  useEffect(() => {
    const interval = setInterval(() => {
      setCurrent(current => {
        if (current > process.stdout.columns)
          clearInterval(interval)

        return current + 1
      })
    }, 100)

    return () => {
      clearInterval(interval)
    }
  }, [])

  return <ProgressBarPacman
    width={process.stdout.columns}
    percent={current / process.stdout.columns}
  />
}

render(<App />)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published