mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
added profile quick info
This commit is contained in:
parent
fa17aac056
commit
1241d2c784
9 changed files with 131 additions and 64 deletions
|
@ -9,6 +9,7 @@ import { useFocusEvent } from '~/hooks/dom/useFocusEvent';
|
|||
import styles from './styles.module.scss';
|
||||
|
||||
interface MenuButtonProps {
|
||||
position?: 'top-end' | 'bottom-end' | 'top-start' | 'bottom-start' | 'top' | 'bottom';
|
||||
icon?: ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
@ -23,11 +24,12 @@ const modifiers = [
|
|||
];
|
||||
|
||||
const MenuButton: FC<MenuButtonProps> = ({
|
||||
position = 'bottom-end',
|
||||
children,
|
||||
className,
|
||||
icon = <Icon icon="dots-vertical" size={24} />,
|
||||
}) => {
|
||||
const { focused, onFocus, onBlur } = useFocusEvent(false, 150);
|
||||
const { focused, onFocus, onBlur } = useFocusEvent(true, 150);
|
||||
|
||||
return (
|
||||
<Manager>
|
||||
|
@ -45,13 +47,9 @@ const MenuButton: FC<MenuButtonProps> = ({
|
|||
</Reference>
|
||||
|
||||
{focused && (
|
||||
<Popper placement="bottom-end" modifiers={modifiers}>
|
||||
<Popper placement={position} modifiers={modifiers}>
|
||||
{({ style, ref, placement }) => (
|
||||
<div
|
||||
style={style}
|
||||
ref={ref}
|
||||
className={classNames(styles.popper, { [styles.top]: placement === 'top-end' })}
|
||||
>
|
||||
<div style={style} ref={ref} className={classNames(styles.popper, styles[placement])}>
|
||||
{children}
|
||||
</div>
|
||||
)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue