diff --git a/.storybook/preview-body.html b/.storybook/preview-body.html
new file mode 100644
index 000000000..a9676ff1f
--- /dev/null
+++ b/.storybook/preview-body.html
@@ -0,0 +1,2 @@
+
+
diff --git a/ui/app/components/app/connected-accounts-list/connected-accounts-list-options-item/connected-accounts-list-options-item.component.js b/ui/app/components/app/connected-accounts-list/connected-accounts-list-options-item/connected-accounts-list-options-item.component.js
deleted file mode 100644
index e1fe4e167..000000000
--- a/ui/app/components/app/connected-accounts-list/connected-accounts-list-options-item/connected-accounts-list-options-item.component.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import classnames from 'classnames'
-import PropTypes from 'prop-types'
-import React, { PureComponent } from 'react'
-
-export default class ConnectedAccountsListOptionsItem extends PureComponent {
- static propTypes = {
- iconClassNames: PropTypes.string.isRequired,
- children: PropTypes.node.isRequired,
- onClick: PropTypes.func,
- }
-
- static defaultProps = {
- onClick: undefined,
- }
-
- render () {
- const { children, iconClassNames, onClick } = this.props
-
- return (
-
- )
- }
-}
diff --git a/ui/app/components/app/connected-accounts-list/connected-accounts-list-options-item/index.js b/ui/app/components/app/connected-accounts-list/connected-accounts-list-options-item/index.js
deleted file mode 100644
index fd9f7f347..000000000
--- a/ui/app/components/app/connected-accounts-list/connected-accounts-list-options-item/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from './connected-accounts-list-options-item.component'
diff --git a/ui/app/components/app/connected-accounts-list/connected-accounts-list-options/connected-accounts-list-options.component.js b/ui/app/components/app/connected-accounts-list/connected-accounts-list-options/connected-accounts-list-options.component.js
index de7b5411c..0fcc2d818 100644
--- a/ui/app/components/app/connected-accounts-list/connected-accounts-list-options/connected-accounts-list-options.component.js
+++ b/ui/app/components/app/connected-accounts-list/connected-accounts-list-options/connected-accounts-list-options.component.js
@@ -1,34 +1,23 @@
import PropTypes from 'prop-types'
-import React, { useRef, useState } from 'react'
-import { createPortal } from 'react-dom'
-import { usePopper } from 'react-popper'
+import React, { useState } from 'react'
+import { Menu } from '../../../ui/menu'
const ConnectedAccountsListOptions = ({ children, onShowOptions, onHideOptions, show }) => {
const [optionsButtonElement, setOptionsButtonElement] = useState(null)
- const [popperElement, setPopperElement] = useState(null)
- const popoverContainerElement = useRef(document.getElementById('popover-content'))
- const { attributes, styles } = usePopper(optionsButtonElement, popperElement, {
- modifiers: [{ name: 'preventOverflow', options: { altBoundary: true } }],
- })
return (
<>
{
show
- ? createPortal(
- <>
-
-
- { children }
-
- >,
- popoverContainerElement.current
+ ? (
+
)
: null
}
diff --git a/ui/app/components/app/connected-accounts-list/connected-accounts-list.component.js b/ui/app/components/app/connected-accounts-list/connected-accounts-list.component.js
index 58fe3d74a..99cae3168 100644
--- a/ui/app/components/app/connected-accounts-list/connected-accounts-list.component.js
+++ b/ui/app/components/app/connected-accounts-list/connected-accounts-list.component.js
@@ -4,7 +4,7 @@ import React, { PureComponent } from 'react'
import ConnectedAccountsListPermissions from './connected-accounts-list-permissions'
import ConnectedAccountsListItem from './connected-accounts-list-item'
import ConnectedAccountsListOptions from './connected-accounts-list-options'
-import ConnectedAccountsListOptionsItem from './connected-accounts-list-options-item'
+import { MenuItem } from '../../ui/menu'
export default class ConnectedAccountsList extends PureComponent {
static contextTypes = {
@@ -112,20 +112,20 @@ export default class ConnectedAccountsList extends PureComponent {
>
{
address === selectedAddress ? null : (
-
{t('switchToThisAccount')}
-
+
)
}
-
{t('disconnectThisAccount')}
-
+
)}
/>
diff --git a/ui/app/components/app/connected-accounts-list/index.scss b/ui/app/components/app/connected-accounts-list/index.scss
index 249802a3e..0333e13a3 100644
--- a/ui/app/components/app/connected-accounts-list/index.scss
+++ b/ui/app/components/app/connected-accounts-list/index.scss
@@ -63,55 +63,11 @@
}
.connected-accounts-options {
- background: $white;
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.214);
- border-radius: 8px;
- width: 225px;
- color: $Black-100;
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 0 16px;
- right: 24px;
-
- font-family: Roboto, 'sans-serif';
- font-size: 14px;
- font-weight: normal;
- line-height: 20px;
-
- z-index: 1050;
-
- &__row {
- background: none;
- font-family: inherit;
- font-size: inherit;
-
- display: flex;
- flex-direction: row;
- align-items: center;
- width: 100%;
- padding: 14px 0;
- cursor: pointer;
-
- &-icon {
- margin-right: 8px;
- }
- }
-
&__button {
background: inherit;
color: $Grey-500;
font-size: 22px;
}
-
- &__background {
- position: absolute;
- top: 0;
- left: 0;
- width: 100vw;
- height: 100vh;
- z-index: 1050;
- }
}
.connected-accounts-permissions {
diff --git a/ui/app/components/app/index.scss b/ui/app/components/app/index.scss
index f4b028291..d44f4942f 100644
--- a/ui/app/components/app/index.scss
+++ b/ui/app/components/app/index.scss
@@ -30,6 +30,8 @@
@import '../ui/identicon/index';
+@import '../ui/menu/menu';
+
@import 'info-box/index';
@import 'menu-bar/index';
diff --git a/ui/app/components/ui/menu/index.js b/ui/app/components/ui/menu/index.js
new file mode 100644
index 000000000..2d624ff68
--- /dev/null
+++ b/ui/app/components/ui/menu/index.js
@@ -0,0 +1,2 @@
+export { default as Menu } from './menu'
+export { default as MenuItem } from './menu-item'
diff --git a/ui/app/components/ui/menu/menu-item.js b/ui/app/components/ui/menu/menu-item.js
new file mode 100644
index 000000000..f232c1d1f
--- /dev/null
+++ b/ui/app/components/ui/menu/menu-item.js
@@ -0,0 +1,31 @@
+import React from 'react'
+import PropTypes from 'prop-types'
+import classnames from 'classnames'
+
+const MenuItem = ({ children, className, iconClassName, onClick }) => (
+
+)
+
+MenuItem.propTypes = {
+ children: PropTypes.node.isRequired,
+ className: PropTypes.string,
+ iconClassName: PropTypes.string,
+ onClick: PropTypes.func,
+}
+
+MenuItem.defaultProps = {
+ className: undefined,
+ iconClassName: undefined,
+ onClick: undefined,
+}
+
+export default MenuItem
diff --git a/ui/app/components/ui/menu/menu.js b/ui/app/components/ui/menu/menu.js
new file mode 100644
index 000000000..8fa40f508
--- /dev/null
+++ b/ui/app/components/ui/menu/menu.js
@@ -0,0 +1,43 @@
+import PropTypes from 'prop-types'
+import React, { useRef, useState } from 'react'
+import { createPortal } from 'react-dom'
+import { usePopper } from 'react-popper'
+import classnames from 'classnames'
+
+const Menu = ({ anchorElement, children, className, onHide, popperOptions }) => {
+ const [popperElement, setPopperElement] = useState(null)
+ const popoverContainerElement = useRef(document.getElementById('popover-content'))
+
+ const { attributes, styles } = usePopper(anchorElement, popperElement, popperOptions)
+
+ return createPortal(
+ <>
+
+
+ { children }
+
+ >,
+ popoverContainerElement.current
+ )
+}
+
+Menu.propTypes = {
+ anchorElement: PropTypes.instanceOf(window.Element),
+ children: PropTypes.node.isRequired,
+ className: PropTypes.string,
+ onHide: PropTypes.func.isRequired,
+ popperOptions: PropTypes.object,
+}
+
+Menu.defaultProps = {
+ anchorElement: undefined,
+ className: undefined,
+ popperOptions: undefined,
+}
+
+export default Menu
diff --git a/ui/app/components/ui/menu/menu.scss b/ui/app/components/ui/menu/menu.scss
new file mode 100644
index 000000000..de6dc6108
--- /dev/null
+++ b/ui/app/components/ui/menu/menu.scss
@@ -0,0 +1,46 @@
+.menu {
+ &__container {
+ background: $white;
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.214);
+ border-radius: 8px;
+ width: 225px;
+ color: $Black-100;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 0 16px;
+
+ font-family: Roboto, 'sans-serif';
+ font-size: 14px;
+ font-weight: normal;
+ line-height: 20px;
+
+ z-index: 1050;
+ }
+
+ &__background {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100vw;
+ height: 100vh;
+ z-index: 1050;
+ }
+}
+
+.menu-item {
+ background: none;
+ font-family: inherit;
+ font-size: inherit;
+
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ width: 100%;
+ padding: 14px 0;
+ cursor: pointer;
+
+ &__icon {
+ margin-right: 8px;
+ }
+}
diff --git a/ui/app/components/ui/menu/menu.stories.js b/ui/app/components/ui/menu/menu.stories.js
new file mode 100644
index 000000000..ec8822d62
--- /dev/null
+++ b/ui/app/components/ui/menu/menu.stories.js
@@ -0,0 +1,36 @@
+import React, { useState } from 'react'
+import { Menu, MenuItem } from '.'
+import { action } from '@storybook/addon-actions'
+
+export default {
+ title: 'Menu',
+}
+
+export const basic = () => {
+ return (
+
+ )
+}
+
+export const anchored = () => {
+ const [anchorElement, setAnchorElement] = useState(null)
+ return (
+ <>
+
+
+ >
+ )
+}