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

close-a-curtain

v0.5.1

Published

This component features an animated curtain effect that dynamically opens and closes based on user interactions. Perfect for adding a dramatic reveal or a hidden content section to your web application.

Downloads

1

Readme

Close a curtain

This component features an animated curtain effect that dynamically opens and closes based on user interactions. Perfect for adding a dramatic reveal or a hidden content section to your web application.

Feel free to use this component and animation in your projects to create engaging user interfaces. We welcome you to customize and extend its functionality as needed!

curtain closed

Demo page: Close a Curtain

How it works

  • Click on the top or bottom section to open or close the curtain.
  • The animation starts from the current position, ensuring a seamless transition between states.
  • Both sections animate simultaneously to provide a synchronized visual effect.

Features:

  • Customizable border and background colors.
  • Configurable border styles and widths.
  • Smooth opening and closing animations with adjustable speed and timing.
  • Open and closing can be reversed on a click.
  • Optional shadow effects.

Installation

To install the Curtain component, use npm:

  npm install close-a-curtain

  yarn add close-a-curtain

Usage

Here is how you can use the Curtain component in your React project.

import { useState } from 'react';
import Curtain from 'close-a-curtain';

const App = () => {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <div>
      <button onClick={() => setIsOpen(!isOpen)}>Toggle Curtain</button>
      <Curtain control={isOpen} setControl={setIsOpen}>
        <h1>Content behind the curtain</h1>
      </Curtain>
    </div>
  );
};

export default App;

curtain demo

Props

The Curtain component accepts the following props:

  control (boolean): Controls the open/close state of the curtain.
  setControl (Dispatch<SetStateAction<boolean>>): Function to set the control state.
  props (CustomProps): Additional properties to customize the curtain's appearance and behavior.

Default Props

The component has the following default properties:

const defaultProps = {
  backgroundColor: '#8b4513',
  borderColor: '#daa520',
  borderWidth: '10px',
  borderStyle: 'double',
  showBorder: true,
  showShadow: true,
  openSpeed: '1s',
  closeSpeed: '0.5s',
  openTiming: 'ease-in',
  closeTiming: 'ease-out',
};

default curtain

Customizing the Component

You can customize the appearance and behavior of the curtain by passing different values for the props. Here is an example of a fully customized curtain:

const CustomCurtain = () => {
  const [isOpen, setIsOpen] = useState(false);

  // All props are optional, default will be used if custom not present
  const curtainProps = {
    backgroundColor: '#000',
    borderColor: '#fff',
    borderWidth: '5px',
    borderStyle: 'solid',
    showBorder: false,
    showShadow: false,
    openSpeed: '5s',
    closeSpeed: '5s',
    openTiming: 'linear',
    closeTiming: 'linear',
  };

  return (
    <div>
      <button onClick={() => setIsOpen(!isOpen)}>Toggle Curtain</button>
      <Curtain control={isOpen} setControl={setIsOpen} props={curtainProps}>
        <h1>Custom Content behind the curtain</h1>
      </Curtain>
    </div>
  );
};

export default CustomCurtain;

custom curtain

To do

  • Style and accesibility in clickable button
  • ~~Start animation on click~~
  • ~~Stop animation on curtain click~~
  • ~~Customize animation start~~
  • ~~Customize animation styles~~
  • ~~Customize curtain styles~~
  • ~~Add informative description~~
  • npm publish Curtain component

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contributing

We welcome contributions to enhance this component! If you find any issues or have suggestions for improvements, please feel free to create an issue or submit a pull request.