mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 18:35:58 +00:00
21 lines
590 B
JavaScript
21 lines
590 B
JavaScript
import React from 'react';
|
|
import { FontIcon } from '../icons';
|
|
import { useShowMenu } from '../modals/showMenu';
|
|
import InlineButton from './InlineButton';
|
|
|
|
export default function DropDownButton({ children }) {
|
|
const buttonRef = React.useRef(null);
|
|
const showMenu = useShowMenu();
|
|
|
|
const handleShowMenu = () => {
|
|
const rect = buttonRef.current.getBoundingClientRect();
|
|
showMenu(rect.left, rect.bottom, children);
|
|
};
|
|
|
|
return (
|
|
<InlineButton buttonRef={buttonRef} onClick={handleShowMenu} square>
|
|
<FontIcon icon="icon chevron-down" />
|
|
</InlineButton>
|
|
);
|
|
}
|