1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 11:01:41 +01:00
metamask-extension/ui/components/app/connected-accounts-list/connected-accounts-list-options/connected-accounts-list-options.component.js
2021-04-28 14:53:59 -05:00

45 lines
1.1 KiB
JavaScript

import PropTypes from 'prop-types';
import React, { useState } from 'react';
import { Menu } from '../../../ui/menu';
const ConnectedAccountsListOptions = ({
children,
onShowOptions,
onHideOptions,
show,
}) => {
const [optionsButtonElement, setOptionsButtonElement] = useState(null);
return (
<>
<button
className="fas fa-ellipsis-v connected-accounts-options__button"
onClick={onShowOptions}
ref={setOptionsButtonElement}
/>
{show ? (
<Menu
anchorElement={optionsButtonElement}
onHide={onHideOptions}
popperOptions={{
modifiers: [
{ name: 'preventOverflow', options: { altBoundary: true } },
],
}}
>
{children}
</Menu>
) : null}
</>
);
};
ConnectedAccountsListOptions.propTypes = {
children: PropTypes.node.isRequired,
onHideOptions: PropTypes.func.isRequired,
onShowOptions: PropTypes.func.isRequired,
show: PropTypes.bool.isRequired,
};
export default ConnectedAccountsListOptions;