File size: 808 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React from "react";
import "./FAQComponent.css";

import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faPlus, faMinus } from "@fortawesome/free-solid-svg-icons";
import { CSSTransition } from 'react-transition-group'

const faqComponent = props => {
  const { faqOpenHandler, text, boxOpen, boxText } = props
  return (
    <>
      <div
        className="faqComponent"
        onClick={faqOpenHandler}
      >
        <div>{text}</div>
        <FontAwesomeIcon icon={boxOpen ? faMinus : faPlus} />
      </div>

      <CSSTransition in={boxOpen} classNames="faq-animation" timeout={500} unmountOnExit>
        <div className="faqComponent" style={{ marginTop: "1.5px" }}>
          {boxText}
        </div>
      </CSSTransition>
    </>
  );
};

export default faqComponent;