webapp/src/components/Nav/ProfilePopup.tsx

50 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-11-14 10:02:08 +00:00
import { useSession } from '../../context/session'
import type { PopupProps } from '../_shared/Popup'
import { Popup } from '../_shared/Popup'
2022-11-20 21:25:59 +00:00
import styles from '../_shared/Popup/Popup.module.scss'
2022-10-26 19:22:22 +00:00
type ProfilePopupProps = Omit<PopupProps, 'children'>
export const ProfilePopup = (props: ProfilePopupProps) => {
const {
session,
actions: { signOut }
2022-11-14 10:02:08 +00:00
} = useSession()
2022-10-26 19:22:22 +00:00
return (
<Popup {...props} horizontalAnchor="right">
2022-10-26 19:22:22 +00:00
<ul class="nodash">
<li>
2022-11-14 20:32:17 +00:00
<a href={`/author/${session().user?.slug}`}>Профиль</a>
2022-10-26 19:22:22 +00:00
</li>
<li>
<a href="#">Черновики</a>
</li>
<li>
<a href="#">Подписки</a>
</li>
<li>
<a href="#">Комментарии</a>
</li>
<li>
<a href="#">Закладки</a>
</li>
<li>
<a href="#">Настройки</a>
</li>
2022-11-02 21:55:29 +00:00
<li class={styles.topBorderItem}>
<a
href="#"
onClick={(event) => {
event.preventDefault()
signOut()
}}
>
Выйти из&nbsp;аккаунта
</a>
2022-10-26 19:22:22 +00:00
</li>
</ul>
</Popup>
)
}