forked from M3-Academy/desafio-react-e-typescript
feat: add funcionalidade abre e fecha no footer
This commit is contained in:
parent
de0c5f430f
commit
c3a67c2fa1
35
src/components/footer/FooterMenu.tsx
Normal file
35
src/components/footer/FooterMenu.tsx
Normal file
@ -0,0 +1,35 @@
|
||||
import React, { useState } from 'react'
|
||||
|
||||
interface IFooterMenuProps{
|
||||
title: string;
|
||||
content1: string;
|
||||
content2: string;
|
||||
content3: string;
|
||||
content4: string;
|
||||
}
|
||||
|
||||
const FooterMenu = (props: IFooterMenuProps) => {
|
||||
const [isActive, setIsActive] = useState(false)
|
||||
|
||||
return (
|
||||
<div className="footer-menu-item">
|
||||
<div
|
||||
className="footer-menu-title"
|
||||
onClick={() => setIsActive(!isActive)}
|
||||
>
|
||||
<div>{props.title}</div>
|
||||
<div className='close-open-menu'>{isActive ? '-' : '+'}</div>
|
||||
</div>
|
||||
{isActive && (
|
||||
<>
|
||||
<li className="footer-menu-content">{props.content1}</li>
|
||||
<li className="footer-menu-content">{props.content2}</li>
|
||||
<li className="footer-menu-content">{props.content3}</li>
|
||||
<li className="footer-menu-content">{props.content4}</li>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default FooterMenu
|
Loading…
Reference in New Issue
Block a user