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

accordion-fog

v0.2.1

Published

Accordion React components with custom background

Downloads

6

Readme

accordion-fog

Graphical control element comprising a vertically stacked list of items. Each item can be "expanded" or "collapsed" to reveal the content associated with that item. Gsap is used for animations, follow this link for more information on gsap https://greensock.com/

About

Accordion-fog is still on the development and learning stage. Feel free to give a feedback, suggestion or advise. Animated circles are main feature of this accordion, be sure to check them out by using FogAccordionBackground or FogAccordionCircles components.

  • 0.2.0 updates: light/dark theme toggle depending on preferred color scheme (with darkMode prop) colored styles awailable with new colorFilled prop

Example

Checkout cube animated accordion by following this link

Installation

yarn add accordion-fog

# or

npm i accordion-fog

Import Components

import {
  FogAccordion,
  FogAccordionBackground,
  FogAccordionCircles,
  FogAccordionContent,
  FogAccordionHeader,
  FogAccordionIcon,
  FogAccordionItem,
  FogAccordionTitle,
} from 'accordion-fog';

Components

  • FogAccordionBackground: custom background.

  • FogAccordionCircles: three animated circles for the background.

  • FogAccordion: main accordion wrapper.

  • FogAccordionItem: accordion item wrapper, manages state of a single item.

  • FogAccordionHeader: triggers opening/closing of a single accordion item.

  • FogAccordionTitle: displays Title for accordion item, takes props as well as children.

  • FogAccordionIcon: an animated arrow icon.

  • FogAccordionContent: the main content for the accordion item.

Usage

Accordion is closed by default, each item can be toggled

Note 🚨 Each FogAccordionHeader must be passed an index prop

<FogAccordion>
  <FogAccordionItem>
    <FogAccordionHeader index={0}>
      <FogAccordionTitle title={'Props title 1'}>
        Accordion title 1
      </FogAccordionTitle>
      <FogAccordionIcon />
    </FogAccordionHeader>
    <FogAccordionContent>
      <div>
        <p>Accordion content</p>
        <p>
          Lorem ipsum dolor sit amet consectetur adipisicing elit. Nostrum,
          quidem voluptatibus. Repudiandae distinctio aperiam, laudantium sequi
          numquam exercitationem. Saepe, doloremque. Lorem ipsum dolor sit amet
          consectetur adipisicing elit. Amet eligendi cupiditate, repellendus
          mollitia at sed aut quaerat voluptas ex eos debitis!
        </p>
      </div>
    </FogAccordionContent>
  </FogAccordionItem>
  <FogAccordionItem>
    <FogAccordionHeader index={1}>
      <FogAccordionTitle>Accordion title 2</FogAccordionTitle>
      <FogAccordionIcon />
    </FogAccordionHeader>
    <FogAccordionContent>
      <div>
        <p>Accordion second content</p>
      </div>
    </FogAccordionContent>
  </FogAccordionItem>
</FogAccordion>

Default regular FogAccordionContent max-height is set to 500px, to change max-height value pass the maxHeight prop to FogAccordionContent. Overflow is set to auto.

<FogAccordionContent maxHeight={'300px'}>
  {...}
</FogAccordionContent>

To make multiple accordion items be visible at the same time, pass the multipleToggle prop

<FogAccordion multipleToggle>
  {...}
</FogAccordion>

To apply cube animation, pass the cube prop

<FogAccordion cube>
  {...}
</FogAccordion>

To apply colored styles, pass the colorFilled prop

<FogAccordion colorFilled>
  {...}
</FogAccordion>

To make accordion style switch accordiong to preferred color scheme, pass the darkMode prop

<FogAccordion darkMode>
  {...}
</FogAccordion>

To add background, wrap your content in FogAccordionBackground, pass colorFilled prop to apply styles or use darkMode prop to apply styles according to preferred color scheme.

<FogAccordionBackground darkMode>
  <FogAccordion>
    {...}
  </FogAccordion>
</FogAccordionBackground>
<FogAccordionBackground colorFilled>
  <FogAccordion>
    {...}
  </FogAccordion>
</FogAccordionBackground>

There is a possibility to use animated circles on the background, just add FogAccordionCircles anywhere in your components. Add className="colorFilled" to color the circles

<div>
    <FogAccordionCircles className="colorFilled"/>
    {...}
</div>

To change arrow icon pass icon prop to FogAccordionIcon after importing it as a ReactComponent

<FogAccordionIcon icon={<Arrow />}>
  {...}
</FogAccordionIcon>

Or pass icon component as a child

<FogAccordionIcon>
  <Arrow />
</FogAccordionIcon>