's'
This commit is contained in:
29
components/NavigationToggle.tsx
Normal file
29
components/NavigationToggle.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
|
||||
interface NavigationToggleProps {
|
||||
icon?: string
|
||||
title: string
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
export function NavigationToggle({ icon, title, children }: NavigationToggleProps) {
|
||||
const [isExpanded, setIsExpanded] = useState(false)
|
||||
|
||||
return (
|
||||
<div>
|
||||
<button
|
||||
onClick={() => setIsExpanded(!isExpanded)}
|
||||
className="flex items-center w-full"
|
||||
>
|
||||
<div className="menu-title">
|
||||
{icon && <i className={icon}></i>}
|
||||
<span>{title}</span>
|
||||
</div>
|
||||
<i className={`fas fa-angle-${isExpanded ? 'down' : 'right'} menu-arrow`}></i>
|
||||
</button>
|
||||
{isExpanded && children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user