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-image-accordion

v1.2.2

Published

Accordion component for React

Downloads

90

Readme

React Image Accordion

A simple and customizable React component that creates an image accordion with smooth animation, inspired by Kevin Powell's tutorial on YouTube.

The image accordion is a modern design pattern that can be used to display images and accompanying information in an interactive and engaging way. This component makes it easy to incorporate this pattern into your React projects.

Installation

Use the package manager npm to install react-image-accordion.

npm i react-image-accordion

Usage

To use the component in your React application, import it and pass the necessary props:

import {ReactImageAccordion} from 'react-image-accordion';

function MyComponent() {
  const accordionData = [
    {
      id: 1,
      title: "Boating",
      image: "https://picsum.photos/400/600",
      alt: "first panel image",
      content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
      svg: "aa (1).svg",
    },
    {
      id: 2,
      title: "Fishing",
      image: "https://picsum.photos/400/600",
      alt: "second panel image",
      content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
      svg: "aa (2).svg",
    },
    {
      id: 3,
      title: "Swimming",
      image: "https://picsum.photos/400/600",
      alt: "third panel image",
      content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
      svg: "aa (3).svg",
    },
    {
      id: 4,
      title: "Kayaking",
      image: "https://picsum.photos/400/600",
      alt: "fourth panel image",
      content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
      svg: "aa (4).svg",
    },
    {
      id: 5,
      title: "Scuba diving",
      image: "https://picsum.photos/400/600",
      alt: "fifth panel image",
      content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Saepe id numquam ab molestias sint beatae provident possimus doloribus autem repudiandae!",
      svg: "aa (5).svg",
    },
  ];

  return (
  <ReactImageAccordion
      accordionData={accordionData}
      AccordionWidth={AccordionWidth}
      AccordionHeight={AccordionHeight}
      ContentSize=[ContentSize]
      onClick={}
      ShowButton={true/false}
    />
  );
}

image


image


| Property | type | Default | Description | | ---------------- |:-------------:|:----------:|:-----------------------:| | accordionData | json data | json file | Source File json | | AccordionWidth | css /optional| 50rem | Accordion Width | | AccordionHeight | css /optional| 30rem | Accordion Height | | ContentSize |Array /optional|[0,1,2,3,4]*| Content font size | | onClick | onCLick | | onClick ATC event | | ShowButton | boolean | false | show or hid button |

*[0,1,2,3,4]

"@media (max-width: 480px)": {
  fontSize: ContentSize[0] || "0.65rem",
},
"@media (min-width: 481px) and (max-width: 768px)": {
  fontSize: ContentSize[1] || "0.8rem",
},
"@media (min-width: 769px) and (max-width: 1024px)": {
  fontSize: ContentSize[2] || "1rem",
},
"@media (min-width: 1025px) and (max-width: 1200px)": {
  fontSize: ContentSize[3] || "1.2rem",
},
"@media (min-width: 1201px)": {
  fontSize: ContentSize[4] || "1.5rem",
},

Sample Code

import MockDocument from "./MOCK_DATA.json";
import { ReactImageAccordion } from "json-pretty-textarea";
export const test = () => {
  return (
  <ReactImageAccordion
      accordionData= {MockAccordion}
      AccordionWidth= "40rem"
      AccordionHeight= "30rem"
      ContentSize={[".5rem", ".5rem", ".6rem", ".7rem", "1.1rem"]}
      ShowButton= {false},
      onClick= {(e) => console.log(e.id, e.title)},
    />
  );
};

StoryBook Sample

[StoryBook]https://react-image-accordion.netlify.app/

Contributing

For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT