Skip to content

DanielArturoAlejoAlvarez/react-accordion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REACT ACCORDION V1

Description

This repository is a Software of Application with React.

Installation

Using React 17.0.1 preferably.

Usage

$ git clone https://github.com/DanielArturoAlejoAlvarez/react-accordion[NAME APP]

$ yarn install 

$ yarn start

Follow the following steps and you're good to go! Important:

alt text

Coding

Component

...
const Accordion = () => {

  const [clicked, setClicked] = useState(false)

  const toggle = (index)=>{
    if (clicked === index) {
      return setClicked(null)
    }
    setClicked(index)
  }

  return (
    <IconContext.Provider value={{color: "#00FF89", size: '25px'}}>
      <AccordionSection>
        <Container>
          {Data.map((item,index)=>(
            <>
              <Wrap onClick={()=>toggle(index)} key={index}>
                <h1>{item.question}</h1>
                <span>{clicked === index ? <FiMinus /> : <FiPlus />}</span>
              </Wrap>
              {clicked === index ? (
                <Dropdown>
                  <p>{item.answer}</p>
                </Dropdown>
              ) : null}              
            </>
          ))}
        </Container>
      </AccordionSection>
    </IconContext.Provider>
    
  )
}
...

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/DanielArturoAlejoAlvarez/react-accordion. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published