add: logout modal to profile dropdown
This commit is contained in:
@@ -9,6 +9,8 @@ import Dropdown from '../utils/Dropdown'
|
|||||||
import Seperator from '../utils/Seperator'
|
import Seperator from '../utils/Seperator'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { useParams } from 'next/navigation'
|
import { useParams } from 'next/navigation'
|
||||||
|
import useToggle from '@/hooks/helpers/useToggle'
|
||||||
|
import LogoutPrompt from '@/features/general/LogoutPrompt'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
profileDropState: boolean,
|
profileDropState: boolean,
|
||||||
@@ -24,6 +26,7 @@ type Props = {
|
|||||||
function TopBar({ profileDropState, toggleProfileDropState, toggleMenuState }: Props) {
|
function TopBar({ profileDropState, toggleProfileDropState, toggleMenuState }: Props) {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const { name } = params;
|
const { name } = params;
|
||||||
|
const { state: logoutModal, toggle: toggleLogoutModal } = useToggle();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
@@ -116,13 +119,25 @@ function TopBar({ profileDropState, toggleProfileDropState, toggleMenuState }: P
|
|||||||
|
|
||||||
<Seperator className='my-6' />
|
<Seperator className='my-6' />
|
||||||
<button
|
<button
|
||||||
onClick={() => { }}
|
onClick={(e) => {
|
||||||
|
toggleLogoutModal(e);
|
||||||
|
toggleProfileDropState?.(e)
|
||||||
|
}}
|
||||||
className='flex items-center gap-3 px-6'>
|
className='flex items-center gap-3 px-6'>
|
||||||
<LogoutCurve size={20} className='stroke-foreground' />
|
<LogoutCurve size={20} className='stroke-foreground' />
|
||||||
<div className='text-xs'>خروج</div>
|
<div className='text-xs'>خروج</div>
|
||||||
</button>
|
</button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
data-active={logoutModal}
|
||||||
|
className='fixed inset-0 data-[active=false]:pointer-events-none z-50'>
|
||||||
|
<LogoutPrompt
|
||||||
|
visible={logoutModal}
|
||||||
|
onClick={toggleLogoutModal}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user