0.3.0 • Published 10 months ago

react-cat-paws v0.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

React - CatPaws

A React component library for adding a cat paw overlay to your web app.

preview

Install & Use

npm install react-cat-paws

Include the <CatPaws/> component in your application.

Component Props

namedefaultdescription
fillScreenfalseIf true then the CatPaws canvas will fill the entire screen instead of just its parent container.
onCloseundefinedHandler for the close button. Only renders the button if a handler is defined.

Example implementation

const App = () => {
  const [showCatPaws, setShowCatPaws] = useState(false);

  return (
    <> 
      <p>Hello World!</p>
      
      <button onClick={() => setShowCatPaws(true)}> click me! </button>
      {showCatPaws && 
        <CatPaws 
          onClose={() => setShowCatPaws(false)}
          fillScreen
        />}
    </>
  );
}

⚠️ Troubleshooting

  • When using this package with Vite a side effect of the automatic caching might cause the images not to load.
    To work around that exclude react-cat-paws from the dependency optimization in the vite.config.ts.
export default defineConfig({
  ...
  optimizeDeps: {
    exclude: [ "react-cat-paws" ]
  },
  ...
})

This project is inspired by the cat Easter egg by Google: https://g.co/kgs/wk2hPY
However, while heavily inspired, all images were painted by me to match Google's style.

Uses Parcel to build and package the React library.

0.3.0

10 months ago

0.2.3

2 years ago

0.2.2

2 years ago