-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef52b5a
commit 6f540f0
Showing
5 changed files
with
22 additions
and
16 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
import React, { useState } from 'react' | ||
import React, { useState } from 'react'; | ||
|
||
const Accordion = ({ title, details }) => { | ||
const [open, setOpen] = useState(false); | ||
|
||
const toggle = () => { | ||
setOpen(!open); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="p-8 duration-200 pr-16 relative border border-standart border-black rounded-standart my-8" onClick={toggle}> | ||
<h2>{title}</h2> | ||
{open && ( | ||
<p className='mt-8'> | ||
{details} | ||
</p> | ||
)} | ||
<i className={`${open && "rotate-180"} fas fa-angle-down duration-300 absolute top-8 right-8 text-3xl`}></i> | ||
<div | ||
className='p-8 duration-200 pr-16 relative border border-standart border-black rounded-standart my-8 max-sm:p-4' | ||
onClick={toggle} | ||
> | ||
<h2 className='max-sm:pr-16'>{title}</h2> | ||
{open && <p className='mt-8'>{details}</p>} | ||
<i | ||
className={`${ | ||
open && 'rotate-180' | ||
} fas fa-angle-down duration-300 absolute top-8 right-8 text-3xl`} | ||
></i> | ||
</div> | ||
) | ||
} | ||
); | ||
}; | ||
|
||
export default Accordion | ||
export default Accordion; |